xref: /aoo42x/main/sc/source/ui/unoobj/styleuno.cxx (revision b3f79822)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sc.hxx"
26 
27 
28 
29 #include "scitems.hxx"
30 #include <editeng/memberids.hrc>
31 #include <svx/algitem.hxx>
32 #include <editeng/boxitem.hxx>
33 #include <editeng/langitem.hxx>
34 #include <editeng/numitem.hxx>
35 #include <svx/pageitem.hxx>
36 #include <editeng/pbinitem.hxx>
37 #include <svx/unomid.hxx>
38 #include <editeng/unonrule.hxx>
39 #include <sfx2/bindings.hxx>
40 #include <sfx2/printer.hxx>
41 #include <vcl/virdev.hxx>
42 #include <svl/itempool.hxx>
43 #include <svl/itemset.hxx>
44 #include <svl/intitem.hxx>
45 #include <svl/zformat.hxx>
46 #include <rtl/uuid.h>
47 
48 #include <com/sun/star/table/BorderLine.hpp>
49 #include <com/sun/star/table/CellVertJustify.hpp>
50 #include <com/sun/star/table/TableBorder.hpp>
51 #include <com/sun/star/table/ShadowFormat.hpp>
52 #include <com/sun/star/table/CellHoriJustify.hpp>
53 #include <com/sun/star/table/CellOrientation.hpp>
54 #include <com/sun/star/style/PageStyleLayout.hpp>
55 #include <com/sun/star/style/GraphicLocation.hpp>
56 #include <com/sun/star/sheet/XHeaderFooterContent.hpp>
57 #include <com/sun/star/util/CellProtection.hpp>
58 #include <com/sun/star/awt/FontSlant.hpp>
59 #include <com/sun/star/awt/Size.hpp>
60 #include <com/sun/star/lang/Locale.hpp>
61 #include <com/sun/star/beans/PropertyAttribute.hpp>
62 
63 #include "styleuno.hxx"
64 #include "docsh.hxx"
65 #include "attrib.hxx"
66 #include "stlpool.hxx"
67 #include "docpool.hxx"
68 #include "unoguard.hxx"
69 #include "miscuno.hxx"
70 #include "convuno.hxx"
71 #include "tablink.hxx"
72 #include "unonames.hxx"
73 #include "unowids.hxx"
74 #include "globstr.hrc"
75 #include "cellsuno.hxx"
76 
77 using namespace ::com::sun::star;
78 
79 //------------------------------------------------------------------------
80 
81 const SfxItemPropertySet* lcl_GetCellStyleSet()
82 {
83     static SfxItemPropertyMapEntry aCellStyleMap_Impl[] =
84 	{
85 		{MAP_CHAR_LEN(SC_UNONAME_ASIANVERT),ATTR_VERTICAL_ASIAN,&getBooleanCppuType(),					0, 0 },
86 		{MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER),ATTR_BORDER,		&::getCppuType((const table::BorderLine*)0),		0, BOTTOM_BORDER | CONVERT_TWIPS },
87 		{MAP_CHAR_LEN(SC_UNONAME_CELLBACK),	ATTR_BACKGROUND,	&::getCppuType((const sal_Int32*)0),			0, MID_BACK_COLOR },
88 		{MAP_CHAR_LEN(SC_UNONAME_CELLPRO),	ATTR_PROTECTION,	&::getCppuType((const util::CellProtection*)0),	0, 0 },
89 		{MAP_CHAR_LEN(SC_UNONAME_CCOLOR),	ATTR_FONT_COLOR,	&::getCppuType((const sal_Int32*)0),			0, 0 },
90 		{MAP_CHAR_LEN(SC_UNONAME_COUTL),	ATTR_FONT_CONTOUR,	&::getBooleanCppuType(),			0, 0 },
91 		{MAP_CHAR_LEN(SC_UNONAME_CCROSS),	ATTR_FONT_CROSSEDOUT,&::getBooleanCppuType(),			0, MID_CROSSED_OUT },
92 		{MAP_CHAR_LEN(SC_UNONAME_CEMPHAS),	ATTR_FONT_EMPHASISMARK,&getCppuType((sal_Int16*)0),			0, MID_EMPHASIS },
93 		{MAP_CHAR_LEN(SC_UNONAME_CFONT),	ATTR_FONT,			&::getCppuType((const sal_Int16*)0),			0, MID_FONT_FAMILY },
94 		{MAP_CHAR_LEN(SC_UNONAME_CFCHARS),	ATTR_FONT,			&getCppuType((sal_Int16*)0),			0, MID_FONT_CHAR_SET },
95 		{MAP_CHAR_LEN(SC_UNO_CJK_CFCHARS),	ATTR_CJK_FONT,		&getCppuType((sal_Int16*)0),			0, MID_FONT_CHAR_SET },
96 		{MAP_CHAR_LEN(SC_UNO_CTL_CFCHARS),	ATTR_CTL_FONT,		&getCppuType((sal_Int16*)0),			0, MID_FONT_CHAR_SET },
97 		{MAP_CHAR_LEN(SC_UNONAME_CFFAMIL),	ATTR_FONT,			&getCppuType((sal_Int16*)0),			0, MID_FONT_FAMILY },
98 		{MAP_CHAR_LEN(SC_UNO_CJK_CFFAMIL),	ATTR_CJK_FONT,		&getCppuType((sal_Int16*)0),			0, MID_FONT_FAMILY },
99 		{MAP_CHAR_LEN(SC_UNO_CTL_CFFAMIL),	ATTR_CTL_FONT,		&getCppuType((sal_Int16*)0),			0, MID_FONT_FAMILY },
100 		{MAP_CHAR_LEN(SC_UNONAME_CFNAME),	ATTR_FONT,			&getCppuType((rtl::OUString*)0),		0, MID_FONT_FAMILY_NAME },
101 		{MAP_CHAR_LEN(SC_UNO_CJK_CFNAME),	ATTR_CJK_FONT,		&getCppuType((rtl::OUString*)0),		0, MID_FONT_FAMILY_NAME },
102 		{MAP_CHAR_LEN(SC_UNO_CTL_CFNAME),	ATTR_CTL_FONT,		&getCppuType((rtl::OUString*)0),		0, MID_FONT_FAMILY_NAME },
103 		{MAP_CHAR_LEN(SC_UNONAME_CFPITCH),	ATTR_FONT,			&getCppuType((sal_Int16*)0),			0, MID_FONT_PITCH },
104 		{MAP_CHAR_LEN(SC_UNO_CJK_CFPITCH),	ATTR_CJK_FONT,		&getCppuType((sal_Int16*)0),			0, MID_FONT_PITCH },
105 		{MAP_CHAR_LEN(SC_UNO_CTL_CFPITCH),	ATTR_CTL_FONT,		&getCppuType((sal_Int16*)0),			0, MID_FONT_PITCH },
106 		{MAP_CHAR_LEN(SC_UNONAME_CFSTYLE),	ATTR_FONT,			&getCppuType((rtl::OUString*)0),		0, MID_FONT_STYLE_NAME },
107 		{MAP_CHAR_LEN(SC_UNO_CJK_CFSTYLE),	ATTR_CJK_FONT,		&getCppuType((rtl::OUString*)0),		0, MID_FONT_STYLE_NAME },
108 		{MAP_CHAR_LEN(SC_UNO_CTL_CFSTYLE),	ATTR_CTL_FONT,		&getCppuType((rtl::OUString*)0),		0, MID_FONT_STYLE_NAME },
109 		{MAP_CHAR_LEN(SC_UNONAME_CHEIGHT),	ATTR_FONT_HEIGHT,	&::getCppuType((const float*)0),			0, MID_FONTHEIGHT | CONVERT_TWIPS },
110 		{MAP_CHAR_LEN(SC_UNO_CJK_CHEIGHT),	ATTR_CJK_FONT_HEIGHT,&::getCppuType((const float*)0),			0, MID_FONTHEIGHT | CONVERT_TWIPS },
111 		{MAP_CHAR_LEN(SC_UNO_CTL_CHEIGHT),	ATTR_CTL_FONT_HEIGHT,&::getCppuType((const float*)0),			0, MID_FONTHEIGHT | CONVERT_TWIPS },
112 		{MAP_CHAR_LEN(SC_UNONAME_CLOCAL),	ATTR_FONT_LANGUAGE,	&::getCppuType((const lang::Locale*)0),			0, MID_LANG_LOCALE },
113 		{MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL),	ATTR_CJK_FONT_LANGUAGE,&::getCppuType((const lang::Locale*)0),			0, MID_LANG_LOCALE },
114 		{MAP_CHAR_LEN(SC_UNO_CTL_CLOCAL),	ATTR_CTL_FONT_LANGUAGE,&::getCppuType((const lang::Locale*)0),			0, MID_LANG_LOCALE },
115 		{MAP_CHAR_LEN(SC_UNONAME_COVER),	ATTR_FONT_OVERLINE, &::getCppuType((const sal_Int16*)0),	0, MID_TL_STYLE },
116 		{MAP_CHAR_LEN(SC_UNONAME_COVRLCOL),	ATTR_FONT_OVERLINE, &getCppuType((sal_Int32*)0),			0, MID_TL_COLOR },
117 		{MAP_CHAR_LEN(SC_UNONAME_COVRLHAS),	ATTR_FONT_OVERLINE, &getBooleanCppuType(),					0, MID_TL_HASCOLOR },
118 		{MAP_CHAR_LEN(SC_UNONAME_CPOST),	ATTR_FONT_POSTURE,	&::getCppuType((const awt::FontSlant*)0),		0, MID_POSTURE },
119 		{MAP_CHAR_LEN(SC_UNO_CJK_CPOST),	ATTR_CJK_FONT_POSTURE,&::getCppuType((const awt::FontSlant*)0),		0, MID_POSTURE },
120 		{MAP_CHAR_LEN(SC_UNO_CTL_CPOST),	ATTR_CTL_FONT_POSTURE,&::getCppuType((const awt::FontSlant*)0),		0, MID_POSTURE },
121 		{MAP_CHAR_LEN(SC_UNONAME_CRELIEF),	ATTR_FONT_RELIEF,	&getCppuType((sal_Int16*)0),			0, MID_RELIEF },
122 		{MAP_CHAR_LEN(SC_UNONAME_CSHADD),	ATTR_FONT_SHADOWED,	&::getBooleanCppuType(),			0, 0 },
123 		{MAP_CHAR_LEN(SC_UNONAME_CSTRIKE),	ATTR_FONT_CROSSEDOUT,&getCppuType((sal_Int16*)0),			0, MID_CROSS_OUT },
124 		{MAP_CHAR_LEN(SC_UNONAME_CUNDER),	ATTR_FONT_UNDERLINE,&::getCppuType((const sal_Int16*)0),	0, MID_TL_STYLE },
125 		{MAP_CHAR_LEN(SC_UNONAME_CUNDLCOL),	ATTR_FONT_UNDERLINE,&getCppuType((sal_Int32*)0),			0, MID_TL_COLOR },
126 		{MAP_CHAR_LEN(SC_UNONAME_CUNDLHAS),	ATTR_FONT_UNDERLINE,&getBooleanCppuType(),					0, MID_TL_HASCOLOR },
127 		{MAP_CHAR_LEN(SC_UNONAME_CWEIGHT),	ATTR_FONT_WEIGHT,	&::getCppuType((const float*)0),			0, MID_WEIGHT },
128 		{MAP_CHAR_LEN(SC_UNO_CJK_CWEIGHT),	ATTR_CJK_FONT_WEIGHT,&::getCppuType((const float*)0),			0, MID_WEIGHT },
129 		{MAP_CHAR_LEN(SC_UNO_CTL_CWEIGHT),	ATTR_CTL_FONT_WEIGHT,&::getCppuType((const float*)0),			0, MID_WEIGHT },
130 		{MAP_CHAR_LEN(SC_UNONAME_CWORDMOD),	ATTR_FONT_WORDLINE,	&getBooleanCppuType(),					0, 0 },
131         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
132         {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
133 		{MAP_CHAR_LEN(SC_UNONAME_DISPNAME),	SC_WID_UNO_DISPNAME,&::getCppuType((rtl::OUString*)0),	beans::PropertyAttribute::READONLY, 0 },
134 		{MAP_CHAR_LEN(SC_UNONAME_CELLHJUS),	ATTR_HOR_JUSTIFY,	&::getCppuType((const table::CellHoriJustify*)0),	0, MID_HORJUST_HORJUST },
135 		{MAP_CHAR_LEN(SC_UNONAME_CELLTRAN),	ATTR_BACKGROUND,	&::getBooleanCppuType(),			0, MID_GRAPHIC_TRANSPARENT },
136 		{MAP_CHAR_LEN(SC_UNONAME_WRAP),		ATTR_LINEBREAK,		&::getBooleanCppuType(),			0, 0 },
137 		{MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER),ATTR_BORDER,		&::getCppuType((const table::BorderLine*)0),		0, LEFT_BORDER | CONVERT_TWIPS },
138 		{MAP_CHAR_LEN(SC_UNONAME_NUMFMT),	ATTR_VALUE_FORMAT,	&::getCppuType((const sal_Int32*)0),			0, 0 },
139 //		{MAP_CHAR_LEN(SC_UNONAME_NUMRULES),	SC_WID_UNO_NUMRULES,&getCppuType((const uno::Reference<container::XIndexReplace>*)0), 0, 0 },
140         {MAP_CHAR_LEN(SC_UNONAME_CELLORI),  ATTR_STACKED,       &::getCppuType((const table::CellOrientation*)0),   0, 0 },
141 		{MAP_CHAR_LEN(SC_UNONAME_PADJUST),	ATTR_HOR_JUSTIFY,	&::getCppuType((const sal_Int16*)0),	0, MID_HORJUST_ADJUST },
142 		{MAP_CHAR_LEN(SC_UNONAME_PBMARGIN),	ATTR_MARGIN,		&::getCppuType((const sal_Int32*)0),			0, MID_MARGIN_LO_MARGIN | CONVERT_TWIPS },
143 		{MAP_CHAR_LEN(SC_UNONAME_PINDENT),	ATTR_INDENT,		&::getCppuType((const sal_Int16*)0),			0, 0 }, //! CONVERT_TWIPS
144 		{MAP_CHAR_LEN(SC_UNONAME_PISCHDIST),ATTR_SCRIPTSPACE,	&::getBooleanCppuType(),					0, 0 },
145 		{MAP_CHAR_LEN(SC_UNONAME_PISFORBID),ATTR_FORBIDDEN_RULES,&::getBooleanCppuType(),					0, 0 },
146 		{MAP_CHAR_LEN(SC_UNONAME_PISHANG),	ATTR_HANGPUNCTUATION,&::getBooleanCppuType(),					0, 0 },
147 		{MAP_CHAR_LEN(SC_UNONAME_PISHYPHEN),ATTR_HYPHENATE,		&getBooleanCppuType(),					0, 0 },
148 		{MAP_CHAR_LEN(SC_UNONAME_PLASTADJ),	ATTR_HOR_JUSTIFY,	&::getCppuType((const sal_Int16*)0),	0, MID_HORJUST_ADJUST },
149 		{MAP_CHAR_LEN(SC_UNONAME_PLMARGIN),	ATTR_MARGIN,		&::getCppuType((const sal_Int32*)0),			0, MID_MARGIN_L_MARGIN  | CONVERT_TWIPS },
150 		{MAP_CHAR_LEN(SC_UNONAME_PRMARGIN),	ATTR_MARGIN,		&::getCppuType((const sal_Int32*)0),			0, MID_MARGIN_R_MARGIN  | CONVERT_TWIPS },
151 		{MAP_CHAR_LEN(SC_UNONAME_PTMARGIN),	ATTR_MARGIN,		&::getCppuType((const sal_Int32*)0),			0, MID_MARGIN_UP_MARGIN | CONVERT_TWIPS },
152 		{MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER),ATTR_BORDER,		&::getCppuType((const table::BorderLine*)0),		0, RIGHT_BORDER | CONVERT_TWIPS },
153 		{MAP_CHAR_LEN(SC_UNONAME_ROTANG),	ATTR_ROTATE_VALUE,	&::getCppuType((const sal_Int32*)0),			0, 0 },
154 		{MAP_CHAR_LEN(SC_UNONAME_ROTREF),	ATTR_ROTATE_MODE,	&::getCppuType((const table::CellVertJustify*)0),	0, 0 },
155 		{MAP_CHAR_LEN(SC_UNONAME_SHADOW),	ATTR_SHADOW,		&::getCppuType((const table::ShadowFormat*)0),	0, 0 | CONVERT_TWIPS },
156         {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT), ATTR_SHRINKTOFIT, &getBooleanCppuType(),               0, 0 },
157 		{MAP_CHAR_LEN(SC_UNONAME_TBLBORD),	SC_WID_UNO_TBLBORD,	&::getCppuType((const table::TableBorder*)0),		0, 0 | CONVERT_TWIPS },
158 		{MAP_CHAR_LEN(SC_UNONAME_TOPBORDER),ATTR_BORDER,		&::getCppuType((const table::BorderLine*)0),		0, TOP_BORDER | CONVERT_TWIPS },
159 		{MAP_CHAR_LEN(SC_UNONAME_USERDEF),	ATTR_USERDEF,		&getCppuType((uno::Reference<container::XNameContainer>*)0), 0, 0 },
160 		{MAP_CHAR_LEN(SC_UNONAME_CELLVJUS),	ATTR_VER_JUSTIFY,	&::getCppuType((const table::CellVertJustify*)0),	0, 0 },
161 		{MAP_CHAR_LEN(SC_UNONAME_WRITING),	ATTR_WRITINGDIR,	&getCppuType((sal_Int16*)0),			0, 0 },
162         {0,0,0,0,0,0}
163 	};
164 	static SfxItemPropertySet aCellStyleSet_Impl( aCellStyleMap_Impl );
165 	return &aCellStyleSet_Impl;
166 }
167 
168 //	Map mit allen Seitenattributen, incl. Kopf-/Fusszeilenattribute
169 
170 const SfxItemPropertySet * lcl_GetPageStyleSet()
171 {
172     static SfxItemPropertyMapEntry aPageStyleMap_Impl[] =
173 	{
174 		{MAP_CHAR_LEN(SC_UNO_PAGE_BACKCOLOR),	ATTR_BACKGROUND,	&::getCppuType((const sal_Int32*)0),			0, MID_BACK_COLOR },
175 		{MAP_CHAR_LEN(SC_UNO_PAGE_GRAPHICFILT),	ATTR_BACKGROUND,	&::getCppuType((const ::rtl::OUString*)0),			0, MID_GRAPHIC_FILTER },
176 		{MAP_CHAR_LEN(SC_UNO_PAGE_GRAPHICLOC),	ATTR_BACKGROUND,	&::getCppuType((const style::GraphicLocation*)0),	0, MID_GRAPHIC_POSITION },
177 		{MAP_CHAR_LEN(SC_UNO_PAGE_GRAPHICURL),	ATTR_BACKGROUND,	&::getCppuType((const ::rtl::OUString*)0),			0, MID_GRAPHIC_URL },
178 		{MAP_CHAR_LEN(SC_UNO_PAGE_BACKTRANS),	ATTR_BACKGROUND,	&::getBooleanCppuType(),			0, MID_GRAPHIC_TRANSPARENT },
179 		{MAP_CHAR_LEN(OLD_UNO_PAGE_BACKCOLOR),	ATTR_BACKGROUND,	&::getCppuType((const sal_Int32*)0),			0, MID_BACK_COLOR },
180 		{MAP_CHAR_LEN(SC_UNO_PAGE_BORDERDIST),	ATTR_BORDER,		&::getCppuType((const sal_Int32*)0),	0, BORDER_DISTANCE | CONVERT_TWIPS },
181 		{MAP_CHAR_LEN(SC_UNO_PAGE_BOTTBORDER),	ATTR_BORDER,		&::getCppuType((const table::BorderLine*)0),		0, BOTTOM_BORDER | CONVERT_TWIPS },
182 		{MAP_CHAR_LEN(SC_UNO_PAGE_BOTTBRDDIST),	ATTR_BORDER,		&::getCppuType((const sal_Int32*)0),	0, BOTTOM_BORDER_DISTANCE | CONVERT_TWIPS },
183 		{MAP_CHAR_LEN(SC_UNO_PAGE_BOTTMARGIN),	ATTR_ULSPACE,		&::getCppuType((const sal_Int32*)0),			0, MID_LO_MARGIN | CONVERT_TWIPS },
184 		{MAP_CHAR_LEN(SC_UNO_PAGE_CENTERHOR),	ATTR_PAGE_HORCENTER,&::getBooleanCppuType(),			0, 0 },
185 		{MAP_CHAR_LEN(SC_UNO_PAGE_CENTERVER),	ATTR_PAGE_VERCENTER,&::getBooleanCppuType(),			0, 0 },
186 		{MAP_CHAR_LEN(SC_UNONAME_DISPNAME),		SC_WID_UNO_DISPNAME,&::getCppuType((rtl::OUString*)0),	beans::PropertyAttribute::READONLY, 0 },
187 		{MAP_CHAR_LEN(SC_UNO_PAGE_FIRSTPAGE),	ATTR_PAGE_FIRSTPAGENO,&::getCppuType((const sal_Int16*)0),		0, 0 },
188 //
189 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRBACKCOL),	SC_WID_UNO_FOOTERSET,&::getCppuType((const sal_Int32*)0),			0, 0 },
190 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFFILT),	SC_WID_UNO_FOOTERSET,&::getCppuType((const ::rtl::OUString*)0),		0, 0 },
191 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFLOC),	SC_WID_UNO_FOOTERSET,&::getCppuType((const style::GraphicLocation*)0), 0, 0 },
192 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFURL),	SC_WID_UNO_FOOTERSET,&::getCppuType((const ::rtl::OUString*)0),		0, 0 },
193 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRBACKTRAN),	SC_WID_UNO_FOOTERSET,&::getBooleanCppuType(),						0, 0 },
194 		{MAP_CHAR_LEN(OLD_UNO_PAGE_FTRBACKCOL),	SC_WID_UNO_FOOTERSET,&::getCppuType((const sal_Int32*)0),			0, 0 },
195 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRBODYDIST),	SC_WID_UNO_FOOTERSET,&::getCppuType((const sal_Int32*)0),			0, 0 },
196 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRBRDDIST),	SC_WID_UNO_FOOTERSET,&::getCppuType((const sal_Int32*)0),			0, 0 },
197 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRBOTTBOR),	SC_WID_UNO_FOOTERSET,&::getCppuType((const table::BorderLine*)0),	0, 0 },
198 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRBOTTBDIS),	SC_WID_UNO_FOOTERSET,&::getCppuType((const sal_Int32*)0),			0, 0 },
199 		{MAP_CHAR_LEN(OLD_UNO_PAGE_FTRDYNAMIC),	SC_WID_UNO_FOOTERSET,&::getBooleanCppuType(),						0, 0 },
200 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRHEIGHT),	SC_WID_UNO_FOOTERSET,&::getCppuType((const sal_Int32*)0),			0, 0 },
201 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRDYNAMIC),	SC_WID_UNO_FOOTERSET,&::getBooleanCppuType(),						0, 0 },
202 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRON),		SC_WID_UNO_FOOTERSET,&::getBooleanCppuType(),						0, 0 },
203 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRSHARED),	SC_WID_UNO_FOOTERSET,&::getBooleanCppuType(),						0, 0 },
204 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTBOR),	SC_WID_UNO_FOOTERSET,&::getCppuType((const table::BorderLine*)0),	0, 0 },
205 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTBDIS),	SC_WID_UNO_FOOTERSET,&::getCppuType((const sal_Int32*)0),			0, 0 },
206 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTMAR),	SC_WID_UNO_FOOTERSET,&::getCppuType((const sal_Int32*)0),			0, 0 },
207 		{MAP_CHAR_LEN(OLD_UNO_PAGE_FTRON),		SC_WID_UNO_FOOTERSET,&::getBooleanCppuType(),						0, 0 },
208 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTBOR),	SC_WID_UNO_FOOTERSET,&::getCppuType((const table::BorderLine*)0),	0, 0 },
209 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTBDIS),SC_WID_UNO_FOOTERSET,&::getCppuType((const sal_Int32*)0),			0, 0 },
210 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTMAR),	SC_WID_UNO_FOOTERSET,&::getCppuType((const sal_Int32*)0),			0, 0 },
211 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRSHADOW),	SC_WID_UNO_FOOTERSET,&::getCppuType((const table::ShadowFormat*)0),	0, 0 },
212 		{MAP_CHAR_LEN(OLD_UNO_PAGE_FTRSHARED),	SC_WID_UNO_FOOTERSET,&::getBooleanCppuType(),						0, 0 },
213 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRTOPBOR),	SC_WID_UNO_FOOTERSET,&::getCppuType((const table::BorderLine*)0),	0, 0 },
214 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRTOPBDIS),	SC_WID_UNO_FOOTERSET,&::getCppuType((const sal_Int32*)0),			0, 0 },
215 //
216 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRBACKCOL),	SC_WID_UNO_HEADERSET,&::getCppuType((const sal_Int32*)0),			0, 0 },
217 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFFILT),	SC_WID_UNO_HEADERSET,&::getCppuType((const ::rtl::OUString*)0),		0, 0 },
218 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFLOC),	SC_WID_UNO_HEADERSET,&::getCppuType((const style::GraphicLocation*)0), 0, 0 },
219 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFURL),	SC_WID_UNO_HEADERSET,&::getCppuType((const ::rtl::OUString*)0),		0, 0 },
220 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRBACKTRAN),	SC_WID_UNO_HEADERSET,&::getBooleanCppuType(),						0, 0 },
221 		{MAP_CHAR_LEN(OLD_UNO_PAGE_HDRBACKCOL),	SC_WID_UNO_HEADERSET,&::getCppuType((const sal_Int32*)0),			0, 0 },
222 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRBODYDIST),	SC_WID_UNO_HEADERSET,&::getCppuType((const sal_Int32*)0),			0, 0 },
223 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRBRDDIST),	SC_WID_UNO_HEADERSET,&::getCppuType((const sal_Int32*)0),			0, 0 },
224 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRBOTTBOR),	SC_WID_UNO_HEADERSET,&::getCppuType((const table::BorderLine*)0),	0, 0 },
225 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRBOTTBDIS),	SC_WID_UNO_HEADERSET,&::getCppuType((const sal_Int32*)0),			0, 0 },
226 		{MAP_CHAR_LEN(OLD_UNO_PAGE_HDRDYNAMIC),	SC_WID_UNO_HEADERSET,&::getBooleanCppuType(),						0, 0 },
227 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRHEIGHT),	SC_WID_UNO_HEADERSET,&::getCppuType((const sal_Int32*)0),			0, 0 },
228 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRDYNAMIC),	SC_WID_UNO_HEADERSET,&::getBooleanCppuType(),						0, 0 },
229 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRON),		SC_WID_UNO_HEADERSET,&::getBooleanCppuType(),						0, 0 },
230 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRSHARED),	SC_WID_UNO_HEADERSET,&::getBooleanCppuType(),						0, 0 },
231 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTBOR),	SC_WID_UNO_HEADERSET,&::getCppuType((const table::BorderLine*)0),	0, 0 },
232 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTBDIS),	SC_WID_UNO_HEADERSET,&::getCppuType((const sal_Int32*)0),			0, 0 },
233 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTMAR),	SC_WID_UNO_HEADERSET,&::getCppuType((const sal_Int32*)0),			0, 0 },
234 		{MAP_CHAR_LEN(OLD_UNO_PAGE_HDRON),		SC_WID_UNO_HEADERSET,&::getBooleanCppuType(),						0, 0 },
235 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTBOR),	SC_WID_UNO_HEADERSET,&::getCppuType((const table::BorderLine*)0),	0, 0 },
236 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTBDIS),SC_WID_UNO_HEADERSET,&::getCppuType((const sal_Int32*)0),			0, 0 },
237 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTMAR),	SC_WID_UNO_HEADERSET,&::getCppuType((const sal_Int32*)0),			0, 0 },
238 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRSHADOW),	SC_WID_UNO_HEADERSET,&::getCppuType((const table::ShadowFormat*)0),	0, 0 },
239 		{MAP_CHAR_LEN(OLD_UNO_PAGE_HDRSHARED),	SC_WID_UNO_HEADERSET,&::getBooleanCppuType(),						0, 0 },
240 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRTOPBOR),	SC_WID_UNO_HEADERSET,&::getCppuType((const table::BorderLine*)0),	0, 0 },
241 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRTOPBDIS),	SC_WID_UNO_HEADERSET,&::getCppuType((const sal_Int32*)0),			0, 0 },
242 //
243 		{MAP_CHAR_LEN(SC_UNO_PAGE_HEIGHT),		ATTR_PAGE_SIZE,		&::getCppuType((const sal_Int32*)0),			0, MID_SIZE_HEIGHT | CONVERT_TWIPS },
244 		{MAP_CHAR_LEN(OLD_UNO_PAGE_BACKTRANS),	ATTR_BACKGROUND,	&::getBooleanCppuType(),			0, MID_GRAPHIC_TRANSPARENT },
245 		{MAP_CHAR_LEN(SC_UNO_PAGE_LANDSCAPE),	ATTR_PAGE,			&::getBooleanCppuType(),			0, MID_PAGE_ORIENTATION },
246 		{MAP_CHAR_LEN(SC_UNO_PAGE_LEFTBORDER),	ATTR_BORDER,		&::getCppuType((const table::BorderLine*)0),		0, LEFT_BORDER | CONVERT_TWIPS },
247 		{MAP_CHAR_LEN(SC_UNO_PAGE_LEFTBRDDIST),	ATTR_BORDER,		&::getCppuType((const sal_Int32*)0),	0, LEFT_BORDER_DISTANCE | CONVERT_TWIPS },
248 		{MAP_CHAR_LEN(SC_UNO_PAGE_LEFTMARGIN),	ATTR_LRSPACE,		&::getCppuType((const sal_Int32*)0),			0, MID_L_MARGIN | CONVERT_TWIPS },
249 		{MAP_CHAR_LEN(SC_UNO_PAGE_LEFTFTRCONT),	ATTR_PAGE_FOOTERLEFT,&::getCppuType((const uno::Reference< sheet::XHeaderFooterContent >*)0), 0, 0 },
250 		{MAP_CHAR_LEN(SC_UNO_PAGE_LEFTHDRCONT),	ATTR_PAGE_HEADERLEFT,&::getCppuType((const uno::Reference< sheet::XHeaderFooterContent >*)0), 0, 0 },
251 		{MAP_CHAR_LEN(SC_UNO_PAGE_NUMBERTYPE),	ATTR_PAGE,			&::getCppuType((const sal_Int16*)0),			0, MID_PAGE_NUMTYPE },
252 		{MAP_CHAR_LEN(SC_UNO_PAGE_SCALEVAL),	ATTR_PAGE_SCALE,	&::getCppuType((const sal_Int16*)0),			0, 0 },
253 		{MAP_CHAR_LEN(SC_UNO_PAGE_SYTLELAYOUT),	ATTR_PAGE,			&::getCppuType((const style::PageStyleLayout*)0),	0, MID_PAGE_LAYOUT },
254 		{MAP_CHAR_LEN(SC_UNO_PAGE_PRINTANNOT),	ATTR_PAGE_NOTES,	&::getBooleanCppuType(),			0, 0 },
255 		{MAP_CHAR_LEN(SC_UNO_PAGE_PRINTCHARTS),	ATTR_PAGE_CHARTS,	&::getBooleanCppuType(),			0, 0 },
256 		{MAP_CHAR_LEN(SC_UNO_PAGE_PRINTDOWN),	ATTR_PAGE_TOPDOWN,	&::getBooleanCppuType(),			0, 0 },
257 		{MAP_CHAR_LEN(SC_UNO_PAGE_PRINTDRAW),	ATTR_PAGE_DRAWINGS,	&::getBooleanCppuType(),			0, 0 },
258 		{MAP_CHAR_LEN(SC_UNO_PAGE_PRINTFORMUL),	ATTR_PAGE_FORMULAS,	&::getBooleanCppuType(),			0, 0 },
259 		{MAP_CHAR_LEN(SC_UNO_PAGE_PRINTGRID),	ATTR_PAGE_GRID,		&::getBooleanCppuType(),			0, 0 },
260 		{MAP_CHAR_LEN(SC_UNO_PAGE_PRINTHEADER),	ATTR_PAGE_HEADERS,	&::getBooleanCppuType(),			0, 0 },
261 		{MAP_CHAR_LEN(SC_UNO_PAGE_PRINTOBJS),	ATTR_PAGE_OBJECTS,	&::getBooleanCppuType(),			0, 0 },
262 		{MAP_CHAR_LEN(SC_UNO_PAGE_PRINTZERO),	ATTR_PAGE_NULLVALS,	&::getBooleanCppuType(),			0, 0 },
263 		{MAP_CHAR_LEN(SC_UNO_PAGE_PAPERTRAY),	ATTR_PAGE_PAPERBIN,	&::getCppuType((const ::rtl::OUString*)0),		0, 0 },
264 		{MAP_CHAR_LEN(SC_UNO_PAGE_RIGHTBORDER),	ATTR_BORDER,		&::getCppuType((const table::BorderLine*)0),		0, RIGHT_BORDER | CONVERT_TWIPS },
265 		{MAP_CHAR_LEN(SC_UNO_PAGE_RIGHTBRDDIST),ATTR_BORDER,		&::getCppuType((const sal_Int32*)0),	0, RIGHT_BORDER_DISTANCE | CONVERT_TWIPS },
266 		{MAP_CHAR_LEN(SC_UNO_PAGE_RIGHTMARGIN),	ATTR_LRSPACE,		&::getCppuType((const sal_Int32*)0),			0, MID_R_MARGIN | CONVERT_TWIPS },
267 		{MAP_CHAR_LEN(SC_UNO_PAGE_RIGHTFTRCON),	ATTR_PAGE_FOOTERRIGHT,&::getCppuType((const uno::Reference< sheet::XHeaderFooterContent >*)0), 0, 0 },
268 		{MAP_CHAR_LEN(SC_UNO_PAGE_RIGHTHDRCON),	ATTR_PAGE_HEADERRIGHT,&::getCppuType((const uno::Reference< sheet::XHeaderFooterContent >*)0), 0, 0 },
269 		{MAP_CHAR_LEN(SC_UNO_PAGE_SCALETOPAG),	ATTR_PAGE_SCALETOPAGES,&::getCppuType((const sal_Int16*)0),		0, 0 },
270 		{MAP_CHAR_LEN(SC_UNO_PAGE_SCALETOX),	ATTR_PAGE_SCALETO,  &::getCppuType((const sal_Int16*)0),		0, 0 },
271 		{MAP_CHAR_LEN(SC_UNO_PAGE_SCALETOY),	ATTR_PAGE_SCALETO,  &::getCppuType((const sal_Int16*)0),		0, 0 },
272 		{MAP_CHAR_LEN(SC_UNO_PAGE_SHADOWFORM),	ATTR_SHADOW,		&::getCppuType((const table::ShadowFormat*)0),	0, 0 | CONVERT_TWIPS },
273 		{MAP_CHAR_LEN(SC_UNO_PAGE_SIZE),		ATTR_PAGE_SIZE,		&::getCppuType((const awt::Size*)0),			0, MID_SIZE_SIZE | CONVERT_TWIPS },
274 		{MAP_CHAR_LEN(SC_UNO_PAGE_TOPBORDER),	ATTR_BORDER,		&::getCppuType((const table::BorderLine*)0),		0, TOP_BORDER | CONVERT_TWIPS },
275 		{MAP_CHAR_LEN(SC_UNO_PAGE_TOPBRDDIST),	ATTR_BORDER,		&::getCppuType((const sal_Int32*)0),	0, TOP_BORDER_DISTANCE | CONVERT_TWIPS },
276 		{MAP_CHAR_LEN(SC_UNO_PAGE_TOPMARGIN),	ATTR_ULSPACE,		&::getCppuType((const sal_Int32*)0),			0, MID_UP_MARGIN | CONVERT_TWIPS },
277 		{MAP_CHAR_LEN(OLD_UNO_PAGE_FTRBACKTRAN),SC_WID_UNO_FOOTERSET,&::getBooleanCppuType(),						0, 0 },
278 		{MAP_CHAR_LEN(OLD_UNO_PAGE_HDRBACKTRAN),SC_WID_UNO_HEADERSET,&::getBooleanCppuType(),						0, 0 },
279 		{MAP_CHAR_LEN(SC_UNONAME_USERDEF),		ATTR_USERDEF,		&getCppuType((uno::Reference<container::XNameContainer>*)0), 0, 0 },
280 		{MAP_CHAR_LEN(SC_UNO_PAGE_WIDTH),		ATTR_PAGE_SIZE,		&::getCppuType((const sal_Int32*)0),			0, MID_SIZE_WIDTH | CONVERT_TWIPS },
281 		{MAP_CHAR_LEN(SC_UNONAME_WRITING),		ATTR_WRITINGDIR,	&getCppuType((sal_Int16*)0),			0, 0 },
282         {0,0,0,0,0,0}
283 	};
284 	static SfxItemPropertySet aPageStyleSet_Impl( aPageStyleMap_Impl );
285 	return &aPageStyleSet_Impl;
286 }
287 
288 //	Map mit Inhalten des Header-Item-Sets
289 
290 const SfxItemPropertyMap* lcl_GetHeaderStyleMap()
291 {
292     static SfxItemPropertyMapEntry aHeaderStyleMap_Impl[] =
293 	{
294 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRBACKCOL),	ATTR_BACKGROUND,	&::getCppuType((const sal_Int32*)0),			0, MID_BACK_COLOR },
295 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFFILT),	ATTR_BACKGROUND,	&::getCppuType((const ::rtl::OUString*)0),			0, MID_GRAPHIC_FILTER },
296 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFLOC),	ATTR_BACKGROUND,	&::getCppuType((const style::GraphicLocation*)0),	0, MID_GRAPHIC_POSITION },
297 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFURL),	ATTR_BACKGROUND,	&::getCppuType((const ::rtl::OUString*)0),			0, MID_GRAPHIC_URL },
298 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRBACKTRAN),	ATTR_BACKGROUND,	&::getBooleanCppuType(),			0, MID_GRAPHIC_TRANSPARENT },
299 		{MAP_CHAR_LEN(OLD_UNO_PAGE_HDRBACKCOL),	ATTR_BACKGROUND,	&::getCppuType((const sal_Int32*)0),			0, MID_BACK_COLOR },
300 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRBODYDIST),	ATTR_ULSPACE,		&::getCppuType((const sal_Int32*)0),			0, MID_LO_MARGIN | CONVERT_TWIPS },
301 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRBRDDIST),	ATTR_BORDER,		&::getCppuType((const sal_Int32*)0),	0, BORDER_DISTANCE | CONVERT_TWIPS },
302 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRBOTTBOR),	ATTR_BORDER,		&::getCppuType((const table::BorderLine*)0),		0, BOTTOM_BORDER | CONVERT_TWIPS },
303 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRBOTTBDIS),	ATTR_BORDER,		&::getCppuType((const sal_Int32*)0),	0, BOTTOM_BORDER_DISTANCE | CONVERT_TWIPS },
304 		{MAP_CHAR_LEN(OLD_UNO_PAGE_HDRDYNAMIC),	ATTR_PAGE_DYNAMIC,	&::getBooleanCppuType(),			0, 0 },
305 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRHEIGHT),	ATTR_PAGE_SIZE,		&::getCppuType((const sal_Int32*)0),			0, MID_SIZE_HEIGHT | CONVERT_TWIPS },
306 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRDYNAMIC),	ATTR_PAGE_DYNAMIC,	&::getBooleanCppuType(),			0, 0 },
307 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRON),		ATTR_PAGE_ON,		&::getBooleanCppuType(),			0, 0 },
308 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRSHARED),	ATTR_PAGE_SHARED,	&::getBooleanCppuType(),			0, 0 },
309 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTBOR),	ATTR_BORDER,		&::getCppuType((const table::BorderLine*)0),		0, LEFT_BORDER | CONVERT_TWIPS },
310 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTBDIS),	ATTR_BORDER,		&::getCppuType((const sal_Int32*)0),	0, LEFT_BORDER_DISTANCE | CONVERT_TWIPS },
311 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTMAR),	ATTR_LRSPACE,		&::getCppuType((const sal_Int32*)0),			0, MID_L_MARGIN | CONVERT_TWIPS },
312 		{MAP_CHAR_LEN(OLD_UNO_PAGE_HDRON),		ATTR_PAGE_ON,		&::getBooleanCppuType(),			0, 0 },
313 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTBOR),	ATTR_BORDER,		&::getCppuType((const table::BorderLine*)0),		0, RIGHT_BORDER | CONVERT_TWIPS },
314 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTBDIS),ATTR_BORDER,		&::getCppuType((const sal_Int32*)0),	0, RIGHT_BORDER_DISTANCE | CONVERT_TWIPS },
315 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTMAR),	ATTR_LRSPACE,		&::getCppuType((const sal_Int32*)0),			0, MID_R_MARGIN | CONVERT_TWIPS },
316 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRSHADOW),	ATTR_SHADOW,		&::getCppuType((const table::ShadowFormat*)0),	0, 0 | CONVERT_TWIPS },
317 		{MAP_CHAR_LEN(OLD_UNO_PAGE_HDRSHARED),	ATTR_PAGE_SHARED,	&::getBooleanCppuType(),			0, 0 },
318 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRTOPBOR),	ATTR_BORDER,		&::getCppuType((const table::BorderLine*)0),		0, TOP_BORDER | CONVERT_TWIPS },
319 		{MAP_CHAR_LEN(SC_UNO_PAGE_HDRTOPBDIS),	ATTR_BORDER,		&::getCppuType((const sal_Int32*)0),	0, TOP_BORDER_DISTANCE | CONVERT_TWIPS },
320 		{MAP_CHAR_LEN(OLD_UNO_PAGE_HDRBACKTRAN),ATTR_BACKGROUND,	&::getBooleanCppuType(),			0, MID_GRAPHIC_TRANSPARENT },
321         {0,0,0,0,0,0}
322 	};
323     static SfxItemPropertyMap aHeaderStyleMap( aHeaderStyleMap_Impl );
324     return &aHeaderStyleMap;
325 }
326 
327 //	Map mit Inhalten des Footer-Item-Sets
328 
329 const SfxItemPropertyMap* lcl_GetFooterStyleMap()
330 {
331     static SfxItemPropertyMapEntry aFooterStyleMap_Impl[] =
332 	{
333 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRBACKCOL),	ATTR_BACKGROUND,	&::getCppuType((const sal_Int32*)0),			0, MID_BACK_COLOR },
334 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFFILT),	ATTR_BACKGROUND,	&::getCppuType((const ::rtl::OUString*)0),			0, MID_GRAPHIC_FILTER },
335 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFLOC),	ATTR_BACKGROUND,	&::getCppuType((const style::GraphicLocation*)0),	0, MID_GRAPHIC_POSITION },
336 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFURL),	ATTR_BACKGROUND,	&::getCppuType((const ::rtl::OUString*)0),			0, MID_GRAPHIC_URL },
337 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRBACKTRAN),	ATTR_BACKGROUND,	&::getBooleanCppuType(),			0, MID_GRAPHIC_TRANSPARENT },
338 		{MAP_CHAR_LEN(OLD_UNO_PAGE_FTRBACKCOL),	ATTR_BACKGROUND,	&::getCppuType((const sal_Int32*)0),			0, MID_BACK_COLOR },
339 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRBODYDIST),	ATTR_ULSPACE,		&::getCppuType((const sal_Int32*)0),			0, MID_UP_MARGIN | CONVERT_TWIPS },
340 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRBRDDIST),	ATTR_BORDER,		&::getCppuType((const sal_Int32*)0),	0, BORDER_DISTANCE | CONVERT_TWIPS },
341 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRBOTTBOR),	ATTR_BORDER,		&::getCppuType((const table::BorderLine*)0),		0, BOTTOM_BORDER | CONVERT_TWIPS },
342 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRBOTTBDIS),	ATTR_BORDER,		&::getCppuType((const sal_Int32*)0),	0, BOTTOM_BORDER_DISTANCE | CONVERT_TWIPS },
343 		{MAP_CHAR_LEN(OLD_UNO_PAGE_FTRDYNAMIC),	ATTR_PAGE_DYNAMIC,	&::getBooleanCppuType(),			0, 0 },
344 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRHEIGHT),	ATTR_PAGE_SIZE,		&::getCppuType((const sal_Int32*)0),			0, MID_SIZE_HEIGHT | CONVERT_TWIPS },
345 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRDYNAMIC),	ATTR_PAGE_DYNAMIC,	&::getBooleanCppuType(),			0, 0 },
346 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRON),		ATTR_PAGE_ON,		&::getBooleanCppuType(),			0, 0 },
347 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRSHARED),	ATTR_PAGE_SHARED,	&::getBooleanCppuType(),			0, 0 },
348 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTBOR),	ATTR_BORDER,		&::getCppuType((const table::BorderLine*)0),		0, LEFT_BORDER | CONVERT_TWIPS },
349 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTBDIS),	ATTR_BORDER,		&::getCppuType((const sal_Int32*)0),	0, LEFT_BORDER_DISTANCE | CONVERT_TWIPS },
350 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTMAR),	ATTR_LRSPACE,		&::getCppuType((const sal_Int32*)0),			0, MID_L_MARGIN | CONVERT_TWIPS },
351 		{MAP_CHAR_LEN(OLD_UNO_PAGE_FTRON),		ATTR_PAGE_ON,		&::getBooleanCppuType(),			0, 0 },
352 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTBOR),	ATTR_BORDER,		&::getCppuType((const table::BorderLine*)0),		0, RIGHT_BORDER | CONVERT_TWIPS },
353 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTBDIS),ATTR_BORDER,		&::getCppuType((const sal_Int32*)0),	0, RIGHT_BORDER_DISTANCE | CONVERT_TWIPS },
354 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTMAR),	ATTR_LRSPACE,		&::getCppuType((const sal_Int32*)0),			0, MID_R_MARGIN | CONVERT_TWIPS },
355 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRSHADOW),	ATTR_SHADOW,		&::getCppuType((const table::ShadowFormat*)0),	0, 0 | CONVERT_TWIPS },
356 		{MAP_CHAR_LEN(OLD_UNO_PAGE_FTRSHARED),	ATTR_PAGE_SHARED,	&::getBooleanCppuType(),			0, 0 },
357 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRTOPBOR),	ATTR_BORDER,		&::getCppuType((const table::BorderLine*)0),		0, TOP_BORDER | CONVERT_TWIPS },
358 		{MAP_CHAR_LEN(SC_UNO_PAGE_FTRTOPBDIS),	ATTR_BORDER,		&::getCppuType((const sal_Int32*)0),	0, TOP_BORDER_DISTANCE | CONVERT_TWIPS },
359 		{MAP_CHAR_LEN(OLD_UNO_PAGE_FTRBACKTRAN),ATTR_BACKGROUND,	&::getBooleanCppuType(),			0, MID_GRAPHIC_TRANSPARENT },
360         {0,0,0,0,0,0}
361 	};
362     static SfxItemPropertyMap aFooterStyleMap( aFooterStyleMap_Impl );
363     return &aFooterStyleMap;
364 }
365 
366 
367 //------------------------------------------------------------------------
368 
369 //	Index-Access auf die Style-Typen: 0 = Cell, 1 = Page
370 
371 #define SC_STYLE_FAMILY_COUNT 2
372 
373 #define SC_FAMILYNAME_CELL	"CellStyles"
374 #define SC_FAMILYNAME_PAGE	"PageStyles"
375 
376 static sal_uInt16 aStyleFamilyTypes[SC_STYLE_FAMILY_COUNT] = { SFX_STYLE_FAMILY_PARA, SFX_STYLE_FAMILY_PAGE };
377 
378 //------------------------------------------------------------------------
379 
380 //!	diese Funktionen in einen allgemeinen Header verschieben
381 inline long TwipsToHMM(long nTwips)	{ return (nTwips * 127 + 36) / 72; }
382 inline long HMMToTwips(long nHMM)	{ return (nHMM * 72 + 63) / 127; }
383 
384 //------------------------------------------------------------------------
385 
386 #define SCSTYLE_SERVICE			"com.sun.star.style.Style"
387 #define SCCELLSTYLE_SERVICE		"com.sun.star.style.CellStyle"
388 #define SCPAGESTYLE_SERVICE		"com.sun.star.style.PageStyle"
389 
390 SC_SIMPLE_SERVICE_INFO( ScStyleFamiliesObj, "ScStyleFamiliesObj", "com.sun.star.style.StyleFamilies" )
391 SC_SIMPLE_SERVICE_INFO( ScStyleFamilyObj, "ScStyleFamilyObj", "com.sun.star.style.StyleFamily" )
392 
393 //------------------------------------------------------------------------
394 
395 #define SC_PAPERBIN_DEFAULTNAME		"[From printer settings]"
396 
397 //------------------------------------------------------------------------
398 
399 //	conversion programmatic <-> display (visible) name
400 //	currently, the core always has the visible names
401 //	the api is required to use programmatic names for default styles
402 //	these programmatic names must never change!
403 
404 #define SC_STYLE_PROG_STANDARD		"Default"
405 #define SC_STYLE_PROG_RESULT		"Result"
406 #define SC_STYLE_PROG_RESULT1		"Result2"
407 #define SC_STYLE_PROG_HEADLINE		"Heading"
408 #define SC_STYLE_PROG_HEADLINE1		"Heading1"
409 #define SC_STYLE_PROG_REPORT		"Report"
410 
411 struct ScDisplayNameMap
412 {
413 	String	aDispName;
414 	String	aProgName;
415 };
416 
417 const ScDisplayNameMap* lcl_GetStyleNameMap( sal_uInt16 nType )
418 {
419 	if ( nType == SFX_STYLE_FAMILY_PARA )
420 	{
421 		static sal_Bool bCellMapFilled = sal_False;
422 		static ScDisplayNameMap aCellMap[6];
423 		if ( !bCellMapFilled )
424 		{
425 			aCellMap[0].aDispName = ScGlobal::GetRscString( STR_STYLENAME_STANDARD );
426 			aCellMap[0].aProgName = String::CreateFromAscii( SC_STYLE_PROG_STANDARD );
427 
428 			aCellMap[1].aDispName = ScGlobal::GetRscString( STR_STYLENAME_RESULT );
429 			aCellMap[1].aProgName = String::CreateFromAscii( SC_STYLE_PROG_RESULT );
430 
431 			aCellMap[2].aDispName = ScGlobal::GetRscString( STR_STYLENAME_RESULT1 );
432 			aCellMap[2].aProgName = String::CreateFromAscii( SC_STYLE_PROG_RESULT1 );
433 
434 			aCellMap[3].aDispName = ScGlobal::GetRscString( STR_STYLENAME_HEADLINE );
435 			aCellMap[3].aProgName = String::CreateFromAscii( SC_STYLE_PROG_HEADLINE );
436 
437 			aCellMap[4].aDispName = ScGlobal::GetRscString( STR_STYLENAME_HEADLINE1 );
438 			aCellMap[4].aProgName = String::CreateFromAscii( SC_STYLE_PROG_HEADLINE1 );
439 
440 			//	last entry remains empty
441 
442 			bCellMapFilled = sal_True;
443 		}
444 		return aCellMap;
445 	}
446 	else if ( nType == SFX_STYLE_FAMILY_PAGE )
447 	{
448 		static sal_Bool bPageMapFilled = sal_False;
449 		static ScDisplayNameMap aPageMap[3];
450 		if ( !bPageMapFilled )
451 		{
452 			aPageMap[0].aDispName = ScGlobal::GetRscString( STR_STYLENAME_STANDARD );
453 			aPageMap[0].aProgName = String::CreateFromAscii( SC_STYLE_PROG_STANDARD );
454 
455 			aPageMap[1].aDispName = ScGlobal::GetRscString( STR_STYLENAME_REPORT );
456 			aPageMap[1].aProgName = String::CreateFromAscii( SC_STYLE_PROG_REPORT );
457 
458 			//	last entry remains empty
459 
460 			bPageMapFilled = sal_True;
461 		}
462 		return aPageMap;
463 	}
464 	DBG_ERROR("invalid family");
465 	return NULL;
466 }
467 
468 //	programmatic name suffix for display names that match other programmatic names
469 //	is " (user)" including a space
470 
471 #define SC_SUFFIX_USER		" (user)"
472 #define SC_SUFFIX_USER_LEN	7
473 
474 sal_Bool lcl_EndsWithUser( const String& rString )
475 {
476 	const sal_Unicode *pChar = rString.GetBuffer();
477 	xub_StrLen nLen = rString.Len();
478 	return nLen >= SC_SUFFIX_USER_LEN &&
479 		   pChar[nLen-7] == ' ' &&
480 		   pChar[nLen-6] == '(' &&
481 		   pChar[nLen-5] == 'u' &&
482 		   pChar[nLen-4] == 's' &&
483 		   pChar[nLen-3] == 'e' &&
484 		   pChar[nLen-2] == 'r' &&
485 		   pChar[nLen-1] == ')';
486 }
487 
488 // static
489 String ScStyleNameConversion::DisplayToProgrammaticName( const String& rDispName, sal_uInt16 nType )
490 {
491 	sal_Bool bDisplayIsProgrammatic = sal_False;
492 
493 	const ScDisplayNameMap* pNames = lcl_GetStyleNameMap( nType );
494 	if (pNames)
495 	{
496 		do
497 		{
498 			if (pNames->aDispName == rDispName)
499 				return pNames->aProgName;
500 			else if (pNames->aProgName == rDispName)
501 				bDisplayIsProgrammatic = sal_True;			// display name matches any programmatic name
502 		}
503 		while( (++pNames)->aDispName.Len() );
504 	}
505 
506 	if ( bDisplayIsProgrammatic || lcl_EndsWithUser( rDispName ) )
507 	{
508 		//	add the (user) suffix if the display name matches any style's programmatic name
509 		//	or if it already contains the suffix
510 
511 		String aRet(rDispName);
512 		aRet.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SC_SUFFIX_USER ) );
513 		return aRet;
514 	}
515 
516 	return rDispName;
517 }
518 
519 // static
520 String ScStyleNameConversion::ProgrammaticToDisplayName( const String& rProgName, sal_uInt16 nType )
521 {
522 	if ( lcl_EndsWithUser( rProgName ) )
523 	{
524 		//	remove the (user) suffix, don't compare to map entries
525 		return rProgName.Copy( 0, rProgName.Len() - SC_SUFFIX_USER_LEN );
526 	}
527 
528 	const ScDisplayNameMap* pNames = lcl_GetStyleNameMap( nType );
529 	if (pNames)
530 	{
531 		do
532 		{
533 			if (pNames->aProgName == rProgName)
534 				return pNames->aDispName;
535 		}
536 		while( (++pNames)->aDispName.Len() );
537 	}
538 	return rProgName;
539 }
540 
541 //------------------------------------------------------------------------
542 
543 sal_Bool lcl_AnyTabProtected( ScDocument& rDoc )
544 {
545 	SCTAB nTabCount = rDoc.GetTableCount();
546 	for (SCTAB i=0; i<nTabCount; i++)
547 		if (rDoc.IsTabProtected(i))
548 			return sal_True;
549 	return sal_False;
550 }
551 
552 //------------------------------------------------------------------------
553 
554 ScStyleFamiliesObj::ScStyleFamiliesObj(ScDocShell* pDocSh) :
555 	pDocShell( pDocSh )
556 {
557 	pDocShell->GetDocument()->AddUnoObject(*this);
558 }
559 
560 ScStyleFamiliesObj::~ScStyleFamiliesObj()
561 {
562 	if (pDocShell)
563 		pDocShell->GetDocument()->RemoveUnoObject(*this);
564 }
565 
566 void ScStyleFamiliesObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
567 {
568 	//	Referenz-Update interessiert hier nicht
569 
570 	if ( rHint.ISA( SfxSimpleHint ) &&
571 			((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
572 	{
573 		pDocShell = NULL;		// ungueltig geworden
574 	}
575 }
576 
577 // XStyleFamilies
578 
579 ScStyleFamilyObj*ScStyleFamiliesObj::GetObjectByType_Impl(sal_uInt16 nType) const
580 {
581 	if ( pDocShell )
582 	{
583 		if ( nType == SFX_STYLE_FAMILY_PARA )
584 			return new ScStyleFamilyObj( pDocShell, SFX_STYLE_FAMILY_PARA );
585 		else if ( nType == SFX_STYLE_FAMILY_PAGE )
586 			return new ScStyleFamilyObj( pDocShell, SFX_STYLE_FAMILY_PAGE );
587 	}
588 	DBG_ERROR("getStyleFamilyByType: keine DocShell oder falscher Typ");
589 	return NULL;
590 }
591 
592 ScStyleFamilyObj* ScStyleFamiliesObj::GetObjectByIndex_Impl(sal_uInt32 nIndex) const
593 {
594 	if ( nIndex < SC_STYLE_FAMILY_COUNT )
595 		return GetObjectByType_Impl(aStyleFamilyTypes[nIndex]);
596 
597 	return NULL;	// ungueltiger Index
598 }
599 
600 ScStyleFamilyObj* ScStyleFamiliesObj::GetObjectByName_Impl(const rtl::OUString& aName) const
601 {
602 	if ( pDocShell )
603 	{
604 		String aNameStr( aName );
605 		if ( aNameStr.EqualsAscii( SC_FAMILYNAME_CELL ) )
606 			return new ScStyleFamilyObj( pDocShell, SFX_STYLE_FAMILY_PARA );
607 		else if ( aNameStr.EqualsAscii( SC_FAMILYNAME_PAGE ) )
608 			return new ScStyleFamilyObj( pDocShell, SFX_STYLE_FAMILY_PAGE );
609 	}
610 	// no assertion - called directly from getByName
611 	return NULL;
612 }
613 
614 // container::XIndexAccess
615 
616 sal_Int32 SAL_CALL ScStyleFamiliesObj::getCount() throw(uno::RuntimeException)
617 {
618 	return SC_STYLE_FAMILY_COUNT;
619 }
620 
621 uno::Any SAL_CALL ScStyleFamiliesObj::getByIndex( sal_Int32 nIndex )
622 							throw(lang::IndexOutOfBoundsException,
623 									lang::WrappedTargetException, uno::RuntimeException)
624 {
625 	ScUnoGuard aGuard;
626 	uno::Reference< container::XNameContainer >  xFamily(GetObjectByIndex_Impl(nIndex));
627 	if (xFamily.is())
628         return uno::makeAny(xFamily);
629 	else
630 		throw lang::IndexOutOfBoundsException();
631 //    return uno::Any();
632 }
633 
634 uno::Type SAL_CALL ScStyleFamiliesObj::getElementType() throw(uno::RuntimeException)
635 {
636 	ScUnoGuard aGuard;
637 	return ::getCppuType((const uno::Reference< container::XNameContainer >*)0);	// muss zu getByIndex passen
638 }
639 
640 sal_Bool SAL_CALL ScStyleFamiliesObj::hasElements() throw(uno::RuntimeException)
641 {
642 	ScUnoGuard aGuard;
643 	return ( getCount() != 0 );
644 }
645 
646 // container::XNameAccess
647 
648 uno::Any SAL_CALL ScStyleFamiliesObj::getByName( const rtl::OUString& aName )
649 					throw(container::NoSuchElementException,
650 						lang::WrappedTargetException, uno::RuntimeException)
651 {
652 	ScUnoGuard aGuard;
653 	uno::Reference< container::XNameContainer >  xFamily(GetObjectByName_Impl(aName));
654 	if (xFamily.is())
655         return uno::makeAny(xFamily);
656 	else
657 		throw container::NoSuchElementException();
658 //    return uno::Any();
659 }
660 
661 uno::Sequence<rtl::OUString> SAL_CALL ScStyleFamiliesObj::getElementNames()
662 												throw(uno::RuntimeException)
663 {
664 	ScUnoGuard aGuard;
665 	uno::Sequence<rtl::OUString> aNames(SC_STYLE_FAMILY_COUNT);
666 	rtl::OUString* pNames = aNames.getArray();
667 	pNames[0] = rtl::OUString::createFromAscii( SC_FAMILYNAME_CELL );
668 	pNames[1] = rtl::OUString::createFromAscii( SC_FAMILYNAME_PAGE );
669 	return aNames;
670 }
671 
672 sal_Bool SAL_CALL ScStyleFamiliesObj::hasByName( const rtl::OUString& aName )
673 										throw(uno::RuntimeException)
674 {
675 	ScUnoGuard aGuard;
676 	String aNameStr( aName );
677 	return ( aNameStr.EqualsAscii( SC_FAMILYNAME_CELL ) || aNameStr.EqualsAscii( SC_FAMILYNAME_PAGE ) );
678 }
679 
680 // style::XStyleLoader
681 
682 void SAL_CALL ScStyleFamiliesObj::loadStylesFromURL( const rtl::OUString& aURL,
683 						const uno::Sequence<beans::PropertyValue>& aOptions )
684 								throw(io::IOException, uno::RuntimeException)
685 {
686 	//!	use aOptions (like Writer)
687 	//!	set flag to disable filter option dialogs when importing
688 
689 	String aFilter;		// empty - detect
690 	String aFiltOpt;
691 	ScDocumentLoader aLoader( aURL, aFilter, aFiltOpt );
692 
693 	ScDocShell* pSource = aLoader.GetDocShell();
694 	if ( pSource && pDocShell )
695 	{
696 		//	collect options
697 
698 		sal_Bool bLoadReplace = sal_True;			// defaults
699 		sal_Bool bLoadCellStyles = sal_True;
700 		sal_Bool bLoadPageStyles = sal_True;
701 
702 		const beans::PropertyValue* pPropArray = aOptions.getConstArray();
703 		long nPropCount = aOptions.getLength();
704 		for (long i = 0; i < nPropCount; i++)
705 		{
706 			const beans::PropertyValue& rProp = pPropArray[i];
707 			String aPropName(rProp.Name);
708 
709 			if (aPropName.EqualsAscii( SC_UNONAME_OVERWSTL ))
710 				bLoadReplace = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
711 			else if (aPropName.EqualsAscii( SC_UNONAME_LOADCELL ))
712 				bLoadCellStyles = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
713 			else if (aPropName.EqualsAscii( SC_UNONAME_LOADPAGE ))
714 				bLoadPageStyles = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
715 		}
716 
717 		pDocShell->LoadStylesArgs( *pSource, bLoadReplace, bLoadCellStyles, bLoadPageStyles );
718 		pDocShell->SetDocumentModified();	// paint is inside LoadStyles
719 	}
720 }
721 
722 uno::Sequence<beans::PropertyValue> SAL_CALL ScStyleFamiliesObj::getStyleLoaderOptions()
723 												throw(uno::RuntimeException)
724 {
725 	//	return defaults for options (?)
726 
727 	uno::Sequence<beans::PropertyValue> aSequence(3);
728 	beans::PropertyValue* pArray = aSequence.getArray();
729 
730 	pArray[0].Name = rtl::OUString::createFromAscii( SC_UNONAME_OVERWSTL );
731 	ScUnoHelpFunctions::SetBoolInAny( pArray[0].Value, sal_True );
732 
733 	pArray[1].Name = rtl::OUString::createFromAscii( SC_UNONAME_LOADCELL );
734 	ScUnoHelpFunctions::SetBoolInAny( pArray[1].Value, sal_True );
735 
736 	pArray[2].Name = rtl::OUString::createFromAscii( SC_UNONAME_LOADPAGE );
737 	ScUnoHelpFunctions::SetBoolInAny( pArray[2].Value, sal_True );
738 
739 	return aSequence;
740 }
741 
742 //------------------------------------------------------------------------
743 
744 ScStyleFamilyObj::ScStyleFamilyObj(ScDocShell* pDocSh, SfxStyleFamily eFam) :
745 	pDocShell( pDocSh ),
746 	eFamily( eFam )
747 {
748 	pDocShell->GetDocument()->AddUnoObject(*this);
749 }
750 
751 ScStyleFamilyObj::~ScStyleFamilyObj()
752 {
753 	if (pDocShell)
754 		pDocShell->GetDocument()->RemoveUnoObject(*this);
755 }
756 
757 void ScStyleFamilyObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
758 {
759 	//	Referenz-Update interessiert hier nicht
760 
761 	if ( rHint.ISA( SfxSimpleHint ) &&
762 			((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
763 	{
764 		pDocShell = NULL;		// ungueltig geworden
765 	}
766 }
767 
768 // XStyleFamily
769 
770 ScStyleObj* ScStyleFamilyObj::GetObjectByIndex_Impl(sal_uInt32 nIndex)
771 {
772 	if ( pDocShell )
773 	{
774 		ScDocument* pDoc = pDocShell->GetDocument();
775 		ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
776 
777 		SfxStyleSheetIterator aIter( pStylePool, eFamily );
778 		if ( nIndex < aIter.Count() )
779 		{
780 			SfxStyleSheetBase* pStyle = aIter[(sal_uInt16)nIndex];
781 			if ( pStyle )
782 			{
783 				return new ScStyleObj( pDocShell, eFamily, String (pStyle->GetName()) );
784 			}
785 		}
786 	}
787 	return NULL;
788 }
789 
790 ScStyleObj* ScStyleFamilyObj::GetObjectByName_Impl(const rtl::OUString& aName)
791 {
792 	if ( pDocShell )
793 	{
794 		String aString(aName);
795 
796 		ScDocument* pDoc = pDocShell->GetDocument();
797 		ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
798 		if ( pStylePool->Find( aString, eFamily ) )
799 			return new ScStyleObj( pDocShell, eFamily, aString );
800 	}
801 	return NULL;
802 }
803 
804 void SAL_CALL ScStyleFamilyObj::insertByName( const rtl::OUString& aName, const uno::Any& aElement )
805 							throw(lang::IllegalArgumentException, container::ElementExistException,
806 									lang::WrappedTargetException, uno::RuntimeException)
807 {
808 	ScUnoGuard aGuard;
809 	sal_Bool bDone = sal_False;
810 	//	Reflection muss nicht uno::XInterface sein, kann auch irgendein Interface sein...
811     uno::Reference< uno::XInterface > xInterface(aElement, uno::UNO_QUERY);
812 	if ( xInterface.is() )
813 	{
814 		ScStyleObj* pStyleObj = ScStyleObj::getImplementation( xInterface );
815 		if ( pStyleObj && pStyleObj->GetFamily() == eFamily &&
816 				!pStyleObj->IsInserted() )	// noch nicht eingefuegt?
817 		{
818             String aNameStr(ScStyleNameConversion::ProgrammaticToDisplayName( aName, sal::static_int_cast<sal_uInt16>(eFamily) ));
819 
820 			ScDocument* pDoc = pDocShell->GetDocument();
821 			ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
822 
823 			//!	DocFunc-Funktion??
824 			//!	Undo ?????????????
825 
826 			if ( !pStylePool->Find( aNameStr, eFamily ) )	// noch nicht vorhanden
827 			{
828                 (void)pStylePool->Make( aNameStr, eFamily, SFXSTYLEBIT_USERDEF );
829 
830                 if ( eFamily == SFX_STYLE_FAMILY_PARA && !pDoc->IsImportingXML() )
831                     pDoc->GetPool()->CellStyleCreated( aNameStr );
832 
833 				pStyleObj->InitDoc( pDocShell, aNameStr );	// Objekt kann benutzt werden
834 
835 				pDocShell->SetDocumentModified();	// verwendet wird der neue Style noch nicht
836 				bDone = sal_True;
837 			}
838 			else
839 				throw container::ElementExistException();
840 		}
841 	}
842 
843 	if (!bDone)
844 	{
845 		//	other errors are handled above
846 		throw lang::IllegalArgumentException();
847 	}
848 }
849 
850 void SAL_CALL ScStyleFamilyObj::replaceByName( const rtl::OUString& aName, const uno::Any& aElement )
851 							throw(lang::IllegalArgumentException, container::NoSuchElementException,
852 									lang::WrappedTargetException, uno::RuntimeException)
853 {
854 	ScUnoGuard aGuard;
855 	//!	zusammenfassen?
856 	removeByName( aName );
857 	insertByName( aName, aElement );
858 }
859 
860 void SAL_CALL ScStyleFamilyObj::removeByName( const rtl::OUString& aName )
861 								throw(container::NoSuchElementException,
862 									lang::WrappedTargetException, uno::RuntimeException)
863 {
864 	ScUnoGuard aGuard;
865 	sal_Bool bFound = sal_False;
866 	if ( pDocShell )
867 	{
868         String aString(ScStyleNameConversion::ProgrammaticToDisplayName( aName, sal::static_int_cast<sal_uInt16>(eFamily) ));
869 
870 		ScDocument* pDoc = pDocShell->GetDocument();
871 		ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
872 
873 		//!	DocFunc-Funktion??
874 		//!	Undo ?????????????
875 
876 		SfxStyleSheetBase* pStyle = pStylePool->Find( aString, eFamily );
877 		if (pStyle)
878 		{
879 			bFound = sal_True;
880 			if ( eFamily == SFX_STYLE_FAMILY_PARA )
881 			{
882 				// wie ScViewFunc::RemoveStyleSheetInUse
883 				VirtualDevice aVDev;
884 				Point aLogic = aVDev.LogicToPixel( Point(1000,1000), MAP_TWIP );
885 				double nPPTX = aLogic.X() / 1000.0;
886 				double nPPTY = aLogic.Y() / 1000.0;
887 				Fraction aZoom(1,1);
888 				pDoc->StyleSheetChanged( pStyle, sal_False, &aVDev, nPPTX, nPPTY, aZoom, aZoom );
889 				pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT );
890 				pDocShell->SetDocumentModified();
891 
892 				pStylePool->Remove( pStyle );
893 
894 				//!	InvalidateAttribs();		// Bindings-Invalidate
895 			}
896 			else
897 			{
898 				if ( pDoc->RemovePageStyleInUse( aString ) )
899 					pDocShell->PageStyleModified( ScGlobal::GetRscString(STR_STYLENAME_STANDARD), sal_True );
900 
901 				pStylePool->Remove( pStyle );
902 
903 				SfxBindings* pBindings = pDocShell->GetViewBindings();
904 				if (pBindings)
905 					pBindings->Invalidate( SID_STYLE_FAMILY4 );
906 				pDocShell->SetDocumentModified();
907 			}
908 		}
909 	}
910 
911 	if (!bFound)
912 		throw container::NoSuchElementException();
913 }
914 
915 // container::XIndexAccess
916 
917 sal_Int32 SAL_CALL ScStyleFamilyObj::getCount() throw(uno::RuntimeException)
918 {
919 	ScUnoGuard aGuard;
920 	if ( pDocShell )
921 	{
922 		ScDocument* pDoc = pDocShell->GetDocument();
923 		ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
924 
925 		SfxStyleSheetIterator aIter( pStylePool, eFamily );
926 		return aIter.Count();
927 	}
928 	return 0;
929 }
930 
931 uno::Any SAL_CALL ScStyleFamilyObj::getByIndex( sal_Int32 nIndex )
932 							throw(lang::IndexOutOfBoundsException,
933 									lang::WrappedTargetException, uno::RuntimeException)
934 {
935 	ScUnoGuard aGuard;
936 	uno::Reference< style::XStyle >  xObj(GetObjectByIndex_Impl(nIndex));
937 	if (xObj.is())
938         return uno::makeAny(xObj);
939 	else
940 		throw lang::IndexOutOfBoundsException();
941 //    return uno::Any();
942 }
943 
944 uno::Type SAL_CALL ScStyleFamilyObj::getElementType() throw(uno::RuntimeException)
945 {
946 	ScUnoGuard aGuard;
947 	return ::getCppuType((const uno::Reference< style::XStyle >*)0);	// muss zu getByIndex passen
948 }
949 
950 sal_Bool SAL_CALL ScStyleFamilyObj::hasElements() throw(uno::RuntimeException)
951 {
952 	ScUnoGuard aGuard;
953 	return ( getCount() != 0 );
954 }
955 
956 // container::XNameAccess
957 
958 uno::Any SAL_CALL ScStyleFamilyObj::getByName( const rtl::OUString& aName )
959 			throw(container::NoSuchElementException,
960 					lang::WrappedTargetException, uno::RuntimeException)
961 {
962 	ScUnoGuard aGuard;
963 	uno::Reference< style::XStyle > xObj(
964         GetObjectByName_Impl( ScStyleNameConversion::ProgrammaticToDisplayName( aName, sal::static_int_cast<sal_uInt16>(eFamily) ) ));
965 	if (xObj.is())
966         return uno::makeAny(xObj);
967 	else
968 		throw container::NoSuchElementException();
969 //    return uno::Any();
970 }
971 
972 uno::Sequence<rtl::OUString> SAL_CALL ScStyleFamilyObj::getElementNames()
973 												throw(uno::RuntimeException)
974 {
975 	ScUnoGuard aGuard;
976 	if ( pDocShell )
977 	{
978 		ScDocument* pDoc = pDocShell->GetDocument();
979 		ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
980 
981 		SfxStyleSheetIterator aIter( pStylePool, eFamily );
982 		sal_uInt16 nCount = aIter.Count();
983 
984 		String aName;
985 		uno::Sequence<rtl::OUString> aSeq(nCount);
986 		rtl::OUString* pAry = aSeq.getArray();
987 		SfxStyleSheetBase* pStyle = aIter.First();
988 		sal_uInt16 nPos = 0;
989 		while (pStyle)
990 		{
991 			DBG_ASSERT( nPos<nCount, "Anzahl durcheinandergekommen" );
992 			if (nPos<nCount)
993 				pAry[nPos++] = ScStyleNameConversion::DisplayToProgrammaticName(
994                                     pStyle->GetName(), sal::static_int_cast<sal_uInt16>(eFamily) );
995 			pStyle = aIter.Next();
996 		}
997 		return aSeq;
998 	}
999 	return uno::Sequence<rtl::OUString>();
1000 }
1001 
1002 sal_Bool SAL_CALL ScStyleFamilyObj::hasByName( const rtl::OUString& aName )
1003 										throw(uno::RuntimeException)
1004 {
1005 	ScUnoGuard aGuard;
1006 	if ( pDocShell )
1007 	{
1008         String aString(ScStyleNameConversion::ProgrammaticToDisplayName( aName, sal::static_int_cast<sal_uInt16>(eFamily) ));
1009 
1010 		ScDocument* pDoc = pDocShell->GetDocument();
1011 		ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
1012 		if ( pStylePool->Find( aString, eFamily ) )
1013 			return sal_True;
1014 	}
1015 	return sal_False;
1016 }
1017 
1018 // XPropertySet
1019 
1020 uno::Reference< beans::XPropertySetInfo > SAL_CALL ScStyleFamilyObj::getPropertySetInfo(  ) throw (uno::RuntimeException)
1021 {
1022     OSL_ENSURE( 0, "###unexpected!" );
1023     return uno::Reference< beans::XPropertySetInfo >();
1024 }
1025 
1026 void SAL_CALL ScStyleFamilyObj::setPropertyValue( const ::rtl::OUString&, const uno::Any& ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
1027 {
1028     OSL_ENSURE( 0, "###unexpected!" );
1029 }
1030 
1031 uno::Any SAL_CALL ScStyleFamilyObj::getPropertyValue( const ::rtl::OUString& sPropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1032 {
1033     uno::Any aRet;
1034 
1035     if ( sPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("DisplayName") ) )
1036     {
1037         ScUnoGuard aGuard;
1038         sal_uInt32 nResId = 0;
1039         switch ( eFamily )
1040         {
1041             case SFX_STYLE_FAMILY_PARA:
1042                 nResId = STR_STYLE_FAMILY_CELL; break;
1043             case SFX_STYLE_FAMILY_PAGE:
1044                 nResId = STR_STYLE_FAMILY_PAGE; break;
1045             default:
1046                 OSL_ENSURE( 0, "ScStyleFamilyObj::getPropertyValue(): invalid family" );
1047         }
1048         if ( nResId > 0 )
1049         {
1050             ::rtl::OUString sDisplayName( ScGlobal::GetRscString( static_cast< sal_uInt16 >( nResId ) ) );
1051             aRet = uno::makeAny( sDisplayName );
1052         }
1053     }
1054     else
1055     {
1056         throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("unknown property: ") ) + sPropertyName, static_cast<OWeakObject *>(this) );
1057     }
1058 
1059     return aRet;
1060 }
1061 
1062 void SAL_CALL ScStyleFamilyObj::addPropertyChangeListener( const ::rtl::OUString&, const uno::Reference< beans::XPropertyChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1063 {
1064     OSL_ENSURE( 0, "###unexpected!" );
1065 }
1066 
1067 void SAL_CALL ScStyleFamilyObj::removePropertyChangeListener( const ::rtl::OUString&, const uno::Reference< beans::XPropertyChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1068 {
1069     OSL_ENSURE( 0, "###unexpected!" );
1070 }
1071 
1072 void SAL_CALL ScStyleFamilyObj::addVetoableChangeListener( const ::rtl::OUString&, const uno::Reference< beans::XVetoableChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1073 {
1074     OSL_ENSURE( 0, "###unexpected!" );
1075 }
1076 
1077 void SAL_CALL ScStyleFamilyObj::removeVetoableChangeListener( const ::rtl::OUString&, const uno::Reference< beans::XVetoableChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1078 {
1079     OSL_ENSURE( 0, "###unexpected!" );
1080 }
1081 
1082 //------------------------------------------------------------------------
1083 
1084 //	Default-ctor wird fuer die Reflection gebraucht
1085 
1086 //UNUSED2008-05  ScStyleObj::ScStyleObj() :
1087 //UNUSED2008-05  aPropSet( lcl_GetCellStyleMap() ),
1088 //UNUSED2008-05  pDocShell( NULL ),
1089 //UNUSED2008-05  eFamily( SFX_STYLE_FAMILY_PARA )
1090 //UNUSED2008-05  {
1091 //UNUSED2008-05  }
1092 
1093 ScStyleObj::ScStyleObj(ScDocShell* pDocSh, SfxStyleFamily eFam, const String& rName) :
1094 	pPropSet( (eFam == SFX_STYLE_FAMILY_PARA) ? lcl_GetCellStyleSet() : lcl_GetPageStyleSet() ),
1095 	pDocShell( pDocSh ),
1096 	eFamily( eFam ),
1097 	aStyleName( rName )
1098 {
1099 	//	pDocShell ist Null, wenn per ServiceProvider erzeugt
1100 
1101 	if (pDocShell)
1102 		pDocShell->GetDocument()->AddUnoObject(*this);
1103 }
1104 
1105 void ScStyleObj::InitDoc( ScDocShell* pNewDocSh, const String& rNewName )
1106 {
1107 	if ( pNewDocSh && !pDocShell )
1108 	{
1109 		aStyleName = rNewName;
1110 		pDocShell = pNewDocSh;
1111 		pDocShell->GetDocument()->AddUnoObject(*this);
1112 	}
1113 }
1114 
1115 ScStyleObj::~ScStyleObj()
1116 {
1117 	if (pDocShell)
1118 		pDocShell->GetDocument()->RemoveUnoObject(*this);
1119 }
1120 
1121 // XUnoTunnel
1122 
1123 sal_Int64 SAL_CALL ScStyleObj::getSomething(
1124 				const uno::Sequence<sal_Int8 >& rId ) throw(uno::RuntimeException)
1125 {
1126 	if ( rId.getLength() == 16 &&
1127           0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
1128 									rId.getConstArray(), 16 ) )
1129 	{
1130         return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
1131 	}
1132 	return 0;
1133 }
1134 
1135 // static
1136 const uno::Sequence<sal_Int8>& ScStyleObj::getUnoTunnelId()
1137 {
1138 	static uno::Sequence<sal_Int8> * pSeq = 0;
1139 	if( !pSeq )
1140 	{
1141 		osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
1142 		if( !pSeq )
1143 		{
1144 			static uno::Sequence< sal_Int8 > aSeq( 16 );
1145 			rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
1146 			pSeq = &aSeq;
1147 		}
1148 	}
1149 	return *pSeq;
1150 }
1151 
1152 // static
1153 ScStyleObj* ScStyleObj::getImplementation(
1154 						const uno::Reference<uno::XInterface> xObj )
1155 {
1156 	ScStyleObj* pRet = NULL;
1157 	uno::Reference<lang::XUnoTunnel> xUT( xObj, uno::UNO_QUERY );
1158 	if (xUT.is())
1159         pRet = reinterpret_cast<ScStyleObj*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
1160 	return pRet;
1161 }
1162 
1163 void ScStyleObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
1164 {
1165 	//	Referenz-Update interessiert hier nicht
1166 
1167 	if ( rHint.ISA( SfxSimpleHint ) &&
1168 			((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
1169 	{
1170 		pDocShell = NULL;		// ungueltig geworden
1171 	}
1172 }
1173 
1174 SfxStyleSheetBase* ScStyleObj::GetStyle_Impl()
1175 {
1176 	if ( pDocShell )
1177 	{
1178 		ScDocument* pDoc = pDocShell->GetDocument();
1179 		ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
1180 		return pStylePool->Find( aStyleName, eFamily );
1181 	}
1182 	return NULL;
1183 }
1184 
1185 // style::XStyle
1186 
1187 sal_Bool SAL_CALL ScStyleObj::isUserDefined() throw(uno::RuntimeException)
1188 {
1189 	ScUnoGuard aGuard;
1190 	SfxStyleSheetBase* pStyle = GetStyle_Impl();
1191 	if (pStyle)
1192 		return pStyle->IsUserDefined();
1193 	return sal_False;
1194 }
1195 
1196 sal_Bool SAL_CALL ScStyleObj::isInUse() throw(uno::RuntimeException)
1197 {
1198 	ScUnoGuard aGuard;
1199 	SfxStyleSheetBase* pStyle = GetStyle_Impl();
1200 	if (pStyle)
1201 		return pStyle->IsUsed();
1202 	return sal_False;
1203 }
1204 
1205 rtl::OUString SAL_CALL ScStyleObj::getParentStyle() throw(uno::RuntimeException)
1206 {
1207 	ScUnoGuard aGuard;
1208 	SfxStyleSheetBase* pStyle = GetStyle_Impl();
1209 	if (pStyle)
1210         return ScStyleNameConversion::DisplayToProgrammaticName( pStyle->GetParent(), sal::static_int_cast<sal_uInt16>(eFamily) );
1211 	return rtl::OUString();
1212 }
1213 
1214 void SAL_CALL ScStyleObj::setParentStyle( const rtl::OUString& rParentStyle )
1215 				throw(container::NoSuchElementException, uno::RuntimeException)
1216 {
1217 	ScUnoGuard aGuard;
1218 	SfxStyleSheetBase* pStyle = GetStyle_Impl();
1219 	if (pStyle)
1220 	{
1221 		//	#70909# cell styles cannot be modified if any sheet is protected
1222 		if ( eFamily == SFX_STYLE_FAMILY_PARA && lcl_AnyTabProtected( *pDocShell->GetDocument() ) )
1223 			return;			//! exception?
1224 
1225 		//!	DocFunc-Funktion??
1226 		//!	Undo ?????????????
1227 
1228         String aString(ScStyleNameConversion::ProgrammaticToDisplayName( rParentStyle, sal::static_int_cast<sal_uInt16>(eFamily) ));
1229 		sal_Bool bOk = pStyle->SetParent( aString );
1230 		if (bOk)
1231 		{
1232 			//	wie bei setPropertyValue
1233 
1234 			ScDocument* pDoc = pDocShell->GetDocument();
1235 			if ( eFamily == SFX_STYLE_FAMILY_PARA )
1236 			{
1237 				//	Zeilenhoehen anpassen...
1238 
1239 				VirtualDevice aVDev;
1240 				Point aLogic = aVDev.LogicToPixel( Point(1000,1000), MAP_TWIP );
1241 				double nPPTX = aLogic.X() / 1000.0;
1242 				double nPPTY = aLogic.Y() / 1000.0;
1243 				Fraction aZoom(1,1);
1244 				pDoc->StyleSheetChanged( pStyle, sal_False, &aVDev, nPPTX, nPPTY, aZoom, aZoom );
1245 
1246 				pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT );
1247 				pDocShell->SetDocumentModified();
1248 			}
1249 			else
1250 			{
1251 				//!	ModifyStyleSheet am Dokument (alte Werte merken)
1252 
1253 				pDocShell->PageStyleModified( aStyleName, sal_True );
1254 			}
1255 		}
1256 	}
1257 }
1258 
1259 // container::XNamed
1260 
1261 rtl::OUString SAL_CALL ScStyleObj::getName() throw(uno::RuntimeException)
1262 {
1263 	ScUnoGuard aGuard;
1264 	SfxStyleSheetBase* pStyle = GetStyle_Impl();
1265 	if (pStyle)
1266         return ScStyleNameConversion::DisplayToProgrammaticName( pStyle->GetName(), sal::static_int_cast<sal_uInt16>(eFamily) );
1267 	return rtl::OUString();
1268 }
1269 
1270 void SAL_CALL ScStyleObj::setName( const rtl::OUString& aNewName )
1271 												throw(uno::RuntimeException)
1272 {
1273 	ScUnoGuard aGuard;
1274 	SfxStyleSheetBase* pStyle = GetStyle_Impl();
1275 	if (pStyle)
1276 	{
1277 		//	#71225# cell styles cannot be renamed if any sheet is protected
1278 		if ( eFamily == SFX_STYLE_FAMILY_PARA && lcl_AnyTabProtected( *pDocShell->GetDocument() ) )
1279 			return;			//! exception?
1280 
1281 		//!	DocFunc-Funktion??
1282 		//!	Undo ?????????????
1283 
1284 		String aString(aNewName);
1285 		sal_Bool bOk = pStyle->SetName( aString );
1286 		if (bOk)
1287 		{
1288 			aStyleName = aString;		//!	notify other objects for this style?
1289 
1290             ScDocument* pDoc = pDocShell->GetDocument();
1291             if ( eFamily == SFX_STYLE_FAMILY_PARA && !pDoc->IsImportingXML() )
1292                 pDoc->GetPool()->CellStyleCreated( aString );
1293 
1294 			//	Zellvorlagen = 2, Seitenvorlagen = 4
1295 			sal_uInt16 nId = ( eFamily == SFX_STYLE_FAMILY_PARA ) ?
1296 							SID_STYLE_FAMILY2 : SID_STYLE_FAMILY4;
1297 			SfxBindings* pBindings = pDocShell->GetViewBindings();
1298 			if (pBindings)
1299 			{
1300 				pBindings->Invalidate( nId );
1301 				pBindings->Invalidate( SID_STYLE_APPLY );
1302 			}
1303 		}
1304 	}
1305 }
1306 
1307 // static
1308 uno::Reference<container::XIndexReplace> ScStyleObj::CreateEmptyNumberingRules()
1309 {
1310 	SvxNumRule aRule( 0, 0, sal_True );			// nothing supported
1311 	return SvxCreateNumRule( &aRule );
1312 }
1313 
1314 // beans::XPropertyState
1315 
1316 const SfxItemSet* ScStyleObj::GetStyleItemSet_Impl( const ::rtl::OUString& rPropName,
1317                                         const SfxItemPropertySimpleEntry*& rpResultEntry )
1318 {
1319 	//!	OUString as argument?
1320 
1321 	SfxStyleSheetBase* pStyle = GetStyle_Impl();
1322 	if (pStyle)
1323 	{
1324         const SfxItemPropertySimpleEntry* pEntry = NULL;
1325 		if ( eFamily == SFX_STYLE_FAMILY_PAGE )
1326 		{
1327             pEntry = lcl_GetHeaderStyleMap()->getByName( rPropName );
1328             if ( pEntry )     // only item-wids in header/footer map
1329             {
1330                 rpResultEntry = pEntry;
1331                 return &((const SvxSetItem&)pStyle->GetItemSet().Get(ATTR_PAGE_HEADERSET)).GetItemSet();
1332             }
1333             pEntry = lcl_GetFooterStyleMap()->getByName( rPropName );
1334             if ( pEntry )      // only item-wids in header/footer map
1335             {
1336                 rpResultEntry = pEntry;
1337                 return &((const SvxSetItem&)pStyle->GetItemSet().Get(ATTR_PAGE_FOOTERSET)).GetItemSet();
1338             }
1339 		}
1340         pEntry = pPropSet->getPropertyMap()->getByName( rPropName );
1341         if ( pEntry )
1342 		{
1343             rpResultEntry = pEntry;
1344 			return &pStyle->GetItemSet();
1345 		}
1346 	}
1347 
1348 	rpResultEntry = NULL;
1349 	return NULL;
1350 }
1351 
1352 beans::PropertyState SAL_CALL ScStyleObj::getPropertyState( const rtl::OUString& aPropertyName )
1353 								throw(beans::UnknownPropertyException, uno::RuntimeException)
1354 {
1355 	ScUnoGuard aGuard;
1356 	beans::PropertyState eRet = beans::PropertyState_DIRECT_VALUE;
1357 
1358     const SfxItemPropertySimpleEntry* pResultEntry = NULL;
1359     const SfxItemSet* pItemSet = GetStyleItemSet_Impl( aPropertyName, pResultEntry );
1360 
1361 	if ( pItemSet && pResultEntry )
1362 	{
1363 		sal_uInt16 nWhich = pResultEntry->nWID;
1364         if ( nWhich == SC_WID_UNO_TBLBORD )
1365         {
1366             nWhich = ATTR_BORDER;
1367         }
1368         if ( IsScItemWid( nWhich ) )
1369         {
1370 		    SfxItemState eState = pItemSet->GetItemState( nWhich, sal_False );
1371 
1372 //           //  if no rotate value is set, look at orientation
1373 //           //! also for a fixed value of 0 (in case orientation is ambiguous)?
1374 //           if ( nWhich == ATTR_ROTATE_VALUE && eState == SFX_ITEM_DEFAULT )
1375 //               eState = pItemSet->GetItemState( ATTR_ORIENTATION, sal_False );
1376 
1377 		    if ( eState == SFX_ITEM_SET )
1378 			    eRet = beans::PropertyState_DIRECT_VALUE;
1379 		    else if ( eState == SFX_ITEM_DEFAULT )
1380 			    eRet = beans::PropertyState_DEFAULT_VALUE;
1381 		    else if ( eState == SFX_ITEM_DONTCARE )
1382 			    eRet = beans::PropertyState_AMBIGUOUS_VALUE;	// kann eigentlich nicht sein...
1383 		    else
1384 		    {
1385 			    DBG_ERROR("unbekannter ItemState");
1386 		    }
1387         }
1388 	}
1389 	return eRet;
1390 }
1391 
1392 uno::Sequence<beans::PropertyState> SAL_CALL ScStyleObj::getPropertyStates(
1393 							const uno::Sequence<rtl::OUString>& aPropertyNames )
1394 					throw(beans::UnknownPropertyException, uno::RuntimeException)
1395 {
1396 	//	duemmliche Default-Implementierung: alles einzeln per getPropertyState holen
1397 	//!	sollte optimiert werden!
1398 
1399 	ScUnoGuard aGuard;
1400 	const rtl::OUString* pNames = aPropertyNames.getConstArray();
1401 	uno::Sequence<beans::PropertyState> aRet(aPropertyNames.getLength());
1402 	beans::PropertyState* pStates = aRet.getArray();
1403 	for(sal_Int32 i = 0; i < aPropertyNames.getLength(); i++)
1404 		pStates[i] = getPropertyState(pNames[i]);
1405 	return aRet;
1406 }
1407 
1408 void SAL_CALL ScStyleObj::setPropertyToDefault( const rtl::OUString& aPropertyName )
1409 							throw(beans::UnknownPropertyException, uno::RuntimeException)
1410 {
1411 	ScUnoGuard aGuard;
1412 
1413     const SfxItemPropertyMap* pMap = pPropSet->getPropertyMap();
1414     const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( aPropertyName );
1415     if ( !pEntry )
1416 		throw beans::UnknownPropertyException();
1417 
1418     SetOnePropertyValue( aPropertyName, pEntry, NULL );
1419 }
1420 
1421 uno::Any SAL_CALL ScStyleObj::getPropertyDefault( const rtl::OUString& aPropertyName )
1422 							throw(beans::UnknownPropertyException, lang::WrappedTargetException,
1423 									uno::RuntimeException)
1424 {
1425 	ScUnoGuard aGuard;
1426 	uno::Any aAny;
1427 
1428     const SfxItemPropertySimpleEntry* pResultEntry = NULL;
1429     const SfxItemSet* pStyleSet = GetStyleItemSet_Impl( aPropertyName, pResultEntry );
1430 
1431 	if ( pStyleSet && pResultEntry )
1432 	{
1433 		sal_uInt16 nWhich = pResultEntry->nWID;
1434 
1435         if ( IsScItemWid( nWhich ) )
1436         {
1437 		    //	Default ist Default vom ItemPool, nicht vom Standard-Style,
1438 		    //	damit es zu setPropertyToDefault passt
1439 		    SfxItemSet aEmptySet( *pStyleSet->GetPool(), pStyleSet->GetRanges() );
1440 		    //	#65253# Default-Items mit falscher Slot-ID funktionieren im SfxItemPropertySet3 nicht
1441 		    //!	Slot-IDs aendern...
1442 		    if ( aEmptySet.GetPool()->GetSlotId(nWhich) == nWhich &&
1443 			     aEmptySet.GetItemState(nWhich, sal_False) == SFX_ITEM_DEFAULT )
1444 		    {
1445 			    aEmptySet.Put( aEmptySet.Get( nWhich ) );
1446 		    }
1447 		    const SfxItemSet* pItemSet = &aEmptySet;
1448 
1449 		    switch ( nWhich )		// fuer Item-Spezial-Behandlungen
1450 		    {
1451 			    case ATTR_VALUE_FORMAT:
1452 				    //	default has no language set
1453 				    aAny <<= sal_Int32( ((const SfxUInt32Item&)pItemSet->Get(nWhich)).GetValue() );
1454 				    break;
1455 			    case ATTR_INDENT:
1456 				    aAny <<= sal_Int16( TwipsToHMM(((const SfxUInt16Item&)
1457 								    pItemSet->Get(nWhich)).GetValue()) );
1458 				    break;
1459 			    case ATTR_PAGE_SCALE:
1460 			    case ATTR_PAGE_SCALETOPAGES:
1461 			    case ATTR_PAGE_FIRSTPAGENO:
1462 				    aAny <<= sal_Int16( ((const SfxUInt16Item&)pItemSet->Get(nWhich)).GetValue() );
1463 				    break;
1464 			    case ATTR_PAGE_CHARTS:
1465 			    case ATTR_PAGE_OBJECTS:
1466 			    case ATTR_PAGE_DRAWINGS:
1467 				    //!	sal_Bool-MID fuer ScViewObjectModeItem definieren?
1468 				    aAny <<= sal_Bool( ((const ScViewObjectModeItem&)pItemSet->Get(nWhich)).
1469 								    GetValue() == VOBJ_MODE_SHOW );
1470 				    break;
1471                 case ATTR_PAGE_SCALETO:
1472                     {
1473                         const ScPageScaleToItem aItem((const ScPageScaleToItem&)pItemSet->Get(nWhich));
1474                         if (aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SC_UNO_PAGE_SCALETOX )))
1475                             aAny = uno::makeAny(static_cast<sal_Int16>(aItem.GetWidth()));
1476                         else
1477                             aAny = uno::makeAny(static_cast<sal_Int16>(aItem.GetHeight()));
1478                     }
1479                     break;
1480 			    default:
1481                     pPropSet->getPropertyValue( *pResultEntry, *pItemSet, aAny );
1482 		    }
1483         }
1484         else if ( IsScUnoWid( nWhich ) )
1485         {
1486             SfxItemSet aEmptySet( *pStyleSet->GetPool(), pStyleSet->GetRanges() );
1487             const SfxItemSet* pItemSet = &aEmptySet;
1488             switch ( nWhich )
1489             {
1490                 case SC_WID_UNO_TBLBORD:
1491                     {
1492                         const SfxPoolItem* pItem = &pItemSet->Get( ATTR_BORDER );
1493                         if ( pItem )
1494                         {
1495                             SvxBoxItem aOuter( *( static_cast<const SvxBoxItem*>( pItem ) ) );
1496                             SvxBoxInfoItem aInner( ATTR_BORDER_INNER );
1497                             table::TableBorder aBorder;
1498                             ScHelperFunctions::FillTableBorder( aBorder, aOuter, aInner );
1499                             aBorder.IsHorizontalLineValid = sal_False;
1500                             aBorder.IsVerticalLineValid = sal_False;
1501                             aBorder.IsDistanceValid = sal_False;
1502                             aAny <<= aBorder;
1503                         }
1504                     }
1505                     break;
1506             }
1507         }
1508 	}
1509 	return aAny;
1510 }
1511 
1512 // XMultiPropertySet
1513 
1514 void SAL_CALL ScStyleObj::setPropertyValues( const uno::Sequence< rtl::OUString >& aPropertyNames,
1515 												const uno::Sequence< uno::Any >& aValues )
1516 								throw (beans::PropertyVetoException, lang::IllegalArgumentException,
1517 										lang::WrappedTargetException, uno::RuntimeException)
1518 {
1519 	ScUnoGuard aGuard;
1520 
1521 	sal_Int32 nCount = aPropertyNames.getLength();
1522 	if ( aValues.getLength() != nCount )
1523 		throw lang::IllegalArgumentException();
1524 
1525 	if ( nCount )
1526 	{
1527 		const rtl::OUString* pNames = aPropertyNames.getConstArray();
1528 		const uno::Any* pValues = aValues.getConstArray();
1529 
1530         const SfxItemPropertyMap* pPropertyMap = pPropSet->getPropertyMap();
1531 		for (sal_Int32 i = 0; i < nCount; i++)
1532 		{
1533             const SfxItemPropertySimpleEntry*  pEntry = pPropertyMap->getByName( pNames[i] );
1534             SetOnePropertyValue( pNames[i], pEntry, &pValues[i] );
1535 		}
1536 	}
1537 }
1538 
1539 uno::Sequence<uno::Any> SAL_CALL ScStyleObj::getPropertyValues(
1540 									const uno::Sequence< rtl::OUString >& aPropertyNames )
1541 								throw (uno::RuntimeException)
1542 {
1543 	ScUnoGuard aGuard;
1544 
1545 	//!	optimize
1546 
1547 	sal_Int32 nCount = aPropertyNames.getLength();
1548 	uno::Sequence<uno::Any> aSequence( nCount );
1549 	if ( nCount )
1550 	{
1551 		uno::Any* pValues = aSequence.getArray();
1552 		for (sal_Int32 i=0; i<nCount; i++)
1553 			pValues[i] = getPropertyValue( aPropertyNames[i] );
1554 	}
1555 	return aSequence;
1556 }
1557 
1558 void SAL_CALL ScStyleObj::addPropertiesChangeListener( const uno::Sequence<rtl::OUString>& /* aPropertyNames */,
1559                                     const uno::Reference<beans::XPropertiesChangeListener>& /* xListener */ )
1560 								throw (uno::RuntimeException)
1561 {
1562 	// no bound properties
1563 }
1564 
1565 void SAL_CALL ScStyleObj::removePropertiesChangeListener(
1566                                     const uno::Reference<beans::XPropertiesChangeListener>& /* xListener */ )
1567 								throw (uno::RuntimeException)
1568 {
1569 	// no bound properties
1570 }
1571 
1572 void SAL_CALL ScStyleObj::firePropertiesChangeEvent( const uno::Sequence<rtl::OUString>& /* aPropertyNames */,
1573                                     const uno::Reference<beans::XPropertiesChangeListener>& /* xListener */ )
1574 								throw (uno::RuntimeException)
1575 {
1576 	// no bound properties
1577 }
1578 
1579 // XMultiPropertyStates
1580 // getPropertyStates already defined for XPropertyState
1581 
1582 void SAL_CALL ScStyleObj::setAllPropertiesToDefault() throw (uno::RuntimeException)
1583 {
1584 	ScUnoGuard aGuard;
1585 
1586 	SfxStyleSheetBase* pStyle = GetStyle_Impl();
1587 	if ( pStyle )
1588 	{
1589 		//	#70909# cell styles cannot be modified if any sheet is protected
1590 		if ( eFamily == SFX_STYLE_FAMILY_PARA && lcl_AnyTabProtected( *pDocShell->GetDocument() ) )
1591 			throw uno::RuntimeException();
1592 
1593 		SfxItemSet& rSet = pStyle->GetItemSet();
1594 		rSet.ClearItem();								// set all items to default
1595 
1596 		//!	merge with SetOneProperty
1597 
1598 		ScDocument* pDoc = pDocShell->GetDocument();
1599 		if ( eFamily == SFX_STYLE_FAMILY_PARA )
1600 		{
1601 			//	row heights
1602 
1603 			VirtualDevice aVDev;
1604 			Point aLogic = aVDev.LogicToPixel( Point(1000,1000), MAP_TWIP );
1605 			double nPPTX = aLogic.X() / 1000.0;
1606 			double nPPTY = aLogic.Y() / 1000.0;
1607 			Fraction aZoom(1,1);
1608 			pDoc->StyleSheetChanged( pStyle, sal_False, &aVDev, nPPTX, nPPTY, aZoom, aZoom );
1609 
1610 			pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT );
1611 			pDocShell->SetDocumentModified();
1612 		}
1613 		else
1614 		{
1615             // #i22448# apply the default BoxInfoItem for page styles again
1616             // (same content as in ScStyleSheet::GetItemSet, to control the dialog)
1617             SvxBoxInfoItem aBoxInfoItem( ATTR_BORDER_INNER );
1618             aBoxInfoItem.SetTable( sal_False );
1619             aBoxInfoItem.SetDist( sal_True );
1620             aBoxInfoItem.SetValid( VALID_DISTANCE, sal_True );
1621             rSet.Put( aBoxInfoItem );
1622 
1623 			pDocShell->PageStyleModified( aStyleName, sal_True );
1624 		}
1625 	}
1626 }
1627 
1628 void SAL_CALL ScStyleObj::setPropertiesToDefault( const uno::Sequence<rtl::OUString>& aPropertyNames )
1629 								throw (beans::UnknownPropertyException, uno::RuntimeException)
1630 {
1631 	ScUnoGuard aGuard;
1632 
1633 	sal_Int32 nCount = aPropertyNames.getLength();
1634 	if ( nCount )
1635 	{
1636 		const rtl::OUString* pNames = aPropertyNames.getConstArray();
1637 
1638         const SfxItemPropertyMap* pPropertyMap = pPropSet->getPropertyMap();
1639 		for (sal_Int32 i = 0; i < nCount; i++)
1640 		{
1641             const SfxItemPropertySimpleEntry*  pEntry = pPropertyMap->getByName( pNames[i] );
1642             SetOnePropertyValue( pNames[i], pEntry, NULL );
1643 		}
1644 	}
1645 }
1646 
1647 uno::Sequence<uno::Any> SAL_CALL ScStyleObj::getPropertyDefaults(
1648 								const uno::Sequence<rtl::OUString>& aPropertyNames )
1649 						throw (beans::UnknownPropertyException, lang::WrappedTargetException,
1650 								uno::RuntimeException)
1651 {
1652 	ScUnoGuard aGuard;
1653 
1654 	//!	optimize
1655 
1656 	sal_Int32 nCount = aPropertyNames.getLength();
1657 	uno::Sequence<uno::Any> aSequence( nCount );
1658 	if ( nCount )
1659 	{
1660 		uno::Any* pValues = aSequence.getArray();
1661 		for (sal_Int32 i=0; i<nCount; i++)
1662 			pValues[i] = getPropertyDefault( aPropertyNames[i] );
1663 	}
1664 	return aSequence;
1665 }
1666 
1667 // beans::XPropertySet
1668 
1669 uno::Reference<beans::XPropertySetInfo> SAL_CALL ScStyleObj::getPropertySetInfo()
1670 														throw(uno::RuntimeException)
1671 {
1672 	ScUnoGuard aGuard;
1673 	return pPropSet->getPropertySetInfo();
1674 }
1675 
1676 void SAL_CALL ScStyleObj::setPropertyValue(
1677 						const rtl::OUString& aPropertyName, const uno::Any& aValue )
1678 				throw(beans::UnknownPropertyException, beans::PropertyVetoException,
1679 						lang::IllegalArgumentException, lang::WrappedTargetException,
1680 						uno::RuntimeException)
1681 {
1682 	ScUnoGuard aGuard;
1683 
1684     const SfxItemPropertySimpleEntry*  pEntry = pPropSet->getPropertyMap()->getByName( aPropertyName );
1685     if ( !pEntry )
1686 		throw beans::UnknownPropertyException();
1687 
1688     SetOnePropertyValue( aPropertyName, pEntry, &aValue );
1689 }
1690 
1691 void ScStyleObj::SetOnePropertyValue( const ::rtl::OUString& rPropertyName, const SfxItemPropertySimpleEntry* pEntry, const uno::Any* pValue )
1692 								throw(lang::IllegalArgumentException, uno::RuntimeException)
1693 {
1694 	SfxStyleSheetBase* pStyle = GetStyle_Impl();
1695     if ( pStyle && pEntry )
1696 	{
1697 		//	#70909# cell styles cannot be modified if any sheet is protected
1698 		if ( eFamily == SFX_STYLE_FAMILY_PARA && lcl_AnyTabProtected( *pDocShell->GetDocument() ) )
1699 			throw uno::RuntimeException();
1700 
1701 		SfxItemSet& rSet = pStyle->GetItemSet();	// direkt im lebenden Style aendern...
1702 		sal_Bool bDone = sal_False;
1703 		if ( eFamily == SFX_STYLE_FAMILY_PAGE )
1704 		{
1705             if(pEntry->nWID == SC_WID_UNO_HEADERSET)
1706             {
1707                 const SfxItemPropertySimpleEntry* pHeaderEntry = lcl_GetHeaderStyleMap()->getByName( rPropertyName );
1708                 if ( pHeaderEntry ) // only item-wids in header/footer map
1709                 {
1710                     SvxSetItem aNewHeader( (const SvxSetItem&)rSet.Get(ATTR_PAGE_HEADERSET) );
1711                     if (pValue)
1712                         pPropSet->setPropertyValue( *pHeaderEntry, *pValue, aNewHeader.GetItemSet() );
1713                     else
1714                         aNewHeader.GetItemSet().ClearItem( pHeaderEntry->nWID );
1715                     rSet.Put( aNewHeader );
1716                     bDone = sal_True;
1717                 }
1718             }
1719             else if(pEntry->nWID == SC_WID_UNO_FOOTERSET)
1720             {
1721                 const SfxItemPropertySimpleEntry* pFooterEntry = lcl_GetFooterStyleMap()->getByName( rPropertyName );
1722                 if ( pFooterEntry ) // only item-wids in header/footer map
1723 				{
1724 					SvxSetItem aNewFooter( (const SvxSetItem&)rSet.Get(ATTR_PAGE_FOOTERSET) );
1725 					if (pValue)
1726                         pPropSet->setPropertyValue( *pFooterEntry, *pValue, aNewFooter.GetItemSet() );
1727 					else
1728                         aNewFooter.GetItemSet().ClearItem( pFooterEntry->nWID );
1729 					rSet.Put( aNewFooter );
1730 					bDone = sal_True;
1731 				}
1732 			}
1733 		}
1734 		if (!bDone)
1735 		{
1736             if ( pEntry )
1737             {
1738                 if ( IsScItemWid( pEntry->nWID ) )
1739 			    {
1740 				    if (pValue)
1741 				    {
1742                         switch ( pEntry->nWID )     // fuer Item-Spezial-Behandlungen
1743 					    {
1744 						    case ATTR_VALUE_FORMAT:
1745 							    {
1746 								    // #67847# language for number formats
1747 								    SvNumberFormatter* pFormatter =
1748 										    pDocShell->GetDocument()->GetFormatTable();
1749 								    sal_uInt32 nOldFormat = ((const SfxUInt32Item&)
1750 										    rSet.Get( ATTR_VALUE_FORMAT )).GetValue();
1751 								    LanguageType eOldLang = ((const SvxLanguageItem&)
1752 										    rSet.Get( ATTR_LANGUAGE_FORMAT )).GetLanguage();
1753 								    nOldFormat = pFormatter->
1754 										    GetFormatForLanguageIfBuiltIn( nOldFormat, eOldLang );
1755 
1756                                     sal_uInt32 nNewFormat = 0;
1757 								    *pValue >>= nNewFormat;
1758 								    rSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNewFormat ) );
1759 
1760 								    const SvNumberformat* pNewEntry = pFormatter->GetEntry( nNewFormat );
1761 								    LanguageType eNewLang =
1762 									    pNewEntry ? pNewEntry->GetLanguage() : LANGUAGE_DONTKNOW;
1763 								    if ( eNewLang != eOldLang && eNewLang != LANGUAGE_DONTKNOW )
1764 									    rSet.Put( SvxLanguageItem( eNewLang, ATTR_LANGUAGE_FORMAT ) );
1765 
1766 								    //!	keep default state of number format if only language changed?
1767 							    }
1768 							    break;
1769 						    case ATTR_INDENT:
1770 							    {
1771                                     sal_Int16 nVal = 0;
1772 								    *pValue >>= nVal;
1773                                     rSet.Put( SfxUInt16Item( pEntry->nWID, (sal_uInt16)HMMToTwips(nVal) ) );
1774 							    }
1775 							    break;
1776 						    case ATTR_ROTATE_VALUE:
1777 							    {
1778                                     sal_Int32 nRotVal = 0;
1779 								    if ( *pValue >>= nRotVal )
1780 								    {
1781 									    //	stored value is always between 0 and 360 deg.
1782 									    nRotVal %= 36000;
1783 									    if ( nRotVal < 0 )
1784 										    nRotVal += 36000;
1785 									    rSet.Put( SfxInt32Item( ATTR_ROTATE_VALUE, nRotVal ) );
1786 								    }
1787 							    }
1788 							    break;
1789                             case ATTR_STACKED:
1790                                 {
1791                                     table::CellOrientation eOrient;
1792                                     if( *pValue >>= eOrient )
1793                                     {
1794                                         switch( eOrient )
1795                                         {
1796                                             case table::CellOrientation_STANDARD:
1797                                                 rSet.Put( SfxBoolItem( ATTR_STACKED, sal_False ) );
1798                                             break;
1799                                             case table::CellOrientation_TOPBOTTOM:
1800                                                 rSet.Put( SfxBoolItem( ATTR_STACKED, sal_False ) );
1801                                                 rSet.Put( SfxInt32Item( ATTR_ROTATE_VALUE, 27000 ) );
1802                                             break;
1803                                             case table::CellOrientation_BOTTOMTOP:
1804                                                 rSet.Put( SfxBoolItem( ATTR_STACKED, sal_False ) );
1805                                                 rSet.Put( SfxInt32Item( ATTR_ROTATE_VALUE, 9000 ) );
1806                                             break;
1807                                             case table::CellOrientation_STACKED:
1808                                                 rSet.Put( SfxBoolItem( ATTR_STACKED, sal_True ) );
1809                                             break;
1810                                             default:
1811                                             {
1812                                                 // added to avoid warnings
1813                                             }
1814                                         }
1815                                     }
1816                                 }
1817                                 break;
1818 						    case ATTR_PAGE_SCALE:
1819 						    case ATTR_PAGE_SCALETOPAGES:
1820                                 {
1821                                     rSet.ClearItem(ATTR_PAGE_SCALETOPAGES);
1822                                     rSet.ClearItem(ATTR_PAGE_SCALE);
1823                                     rSet.ClearItem(ATTR_PAGE_SCALETO);
1824                                     sal_Int16 nVal = 0;
1825                                     *pValue >>= nVal;
1826                                     rSet.Put( SfxUInt16Item( pEntry->nWID, nVal ) );
1827                                 }
1828                                 break;
1829 						    case ATTR_PAGE_FIRSTPAGENO:
1830 							    {
1831                                     sal_Int16 nVal = 0;
1832 								    *pValue >>= nVal;
1833                                     rSet.Put( SfxUInt16Item( ATTR_PAGE_FIRSTPAGENO, nVal ) );
1834 							    }
1835 							    break;
1836 						    case ATTR_PAGE_CHARTS:
1837 						    case ATTR_PAGE_OBJECTS:
1838 						    case ATTR_PAGE_DRAWINGS:
1839 							    {
1840                                     sal_Bool bBool = sal_False;
1841 								    *pValue >>= bBool;
1842 								    //!	sal_Bool-MID fuer ScViewObjectModeItem definieren?
1843                                     rSet.Put( ScViewObjectModeItem( pEntry->nWID,
1844 									    bBool ? VOBJ_MODE_SHOW : VOBJ_MODE_HIDE ) );
1845 							    }
1846 							    break;
1847 						    case ATTR_PAGE_PAPERBIN:
1848 							    {
1849 								    sal_uInt8 nTray = PAPERBIN_PRINTER_SETTINGS;
1850 								    sal_Bool bFound = sal_False;
1851 
1852 								    rtl::OUString aName;
1853 								    if ( *pValue >>= aName )
1854 								    {
1855 									    if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_PAPERBIN_DEFAULTNAME ) ) )
1856 										    bFound = sal_True;
1857 									    else
1858 									    {
1859 										    Printer* pPrinter = pDocShell->GetPrinter();
1860 										    if (pPrinter)
1861 										    {
1862 											    String aNameStr = aName;
1863 											    sal_uInt16 nCount = pPrinter->GetPaperBinCount();
1864 											    for (sal_uInt16 i=0; i<nCount; i++)
1865 												    if ( aNameStr == pPrinter->GetPaperBinName(i) )
1866 												    {
1867 													    nTray = (sal_uInt8) i;
1868 													    bFound = sal_True;
1869 													    break;
1870 												    }
1871 										    }
1872 									    }
1873 								    }
1874 								    if ( bFound )
1875 									    rSet.Put( SvxPaperBinItem( ATTR_PAGE_PAPERBIN, nTray ) );
1876 								    else
1877 									    throw lang::IllegalArgumentException();
1878 							    }
1879 							    break;
1880                             case ATTR_PAGE_SCALETO:
1881                                 {
1882                                     sal_Int16 nPages = 0;
1883                                     if (*pValue >>= nPages)
1884                                     {
1885                                         ScPageScaleToItem aItem = ((const ScPageScaleToItem&)rSet.Get(ATTR_PAGE_SCALETO));
1886                                         if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SC_UNO_PAGE_SCALETOX)))
1887                                             aItem.SetWidth(static_cast<sal_uInt16>(nPages));
1888                                         else
1889                                             aItem.SetHeight(static_cast<sal_uInt16>(nPages));
1890                                         rSet.Put( aItem );
1891                                         rSet.ClearItem(ATTR_PAGE_SCALETOPAGES);
1892                                         rSet.ClearItem(ATTR_PAGE_SCALE);
1893                                     }
1894                                 }
1895                                 break;
1896 						    default:
1897 							    //	#65253# Default-Items mit falscher Slot-ID
1898 							    //	funktionieren im SfxItemPropertySet3 nicht
1899 							    //!	Slot-IDs aendern...
1900                                 if ( rSet.GetPool()->GetSlotId(pEntry->nWID) == pEntry->nWID &&
1901                                      rSet.GetItemState(pEntry->nWID, sal_False) == SFX_ITEM_DEFAULT )
1902 							    {
1903                                     rSet.Put( rSet.Get(pEntry->nWID) );
1904 							    }
1905                                 pPropSet->setPropertyValue( *pEntry, *pValue, rSet );
1906 					    }
1907 				    }
1908 				    else
1909 				    {
1910                         rSet.ClearItem( pEntry->nWID );
1911 					    // #67847# language for number formats
1912                         if ( pEntry->nWID == ATTR_VALUE_FORMAT )
1913 						    rSet.ClearItem( ATTR_LANGUAGE_FORMAT );
1914 
1915 					    //!	for ATTR_ROTATE_VALUE, also reset ATTR_ORIENTATION?
1916 				    }
1917 			    }
1918                 else if ( IsScUnoWid( pEntry->nWID ) )
1919                 {
1920                     switch ( pEntry->nWID )
1921                     {
1922                         case SC_WID_UNO_TBLBORD:
1923                             {
1924                                 if (pValue)
1925                                 {
1926                                     table::TableBorder aBorder;
1927                                     if ( *pValue >>= aBorder )
1928                                     {
1929                                         SvxBoxItem aOuter( ATTR_BORDER );
1930                                         SvxBoxInfoItem aInner( ATTR_BORDER_INNER );
1931                                         ScHelperFunctions::FillBoxItems( aOuter, aInner, aBorder );
1932                                         rSet.Put( aOuter );
1933                                     }
1934                                 }
1935                                 else
1936                                 {
1937                                     rSet.ClearItem( ATTR_BORDER );
1938                                 }
1939                             }
1940                             break;
1941                     }
1942                 }
1943             }
1944 		}
1945 
1946 		//!	DocFunc-Funktion??
1947 		//!	Undo ?????????????
1948 
1949 		ScDocument* pDoc = pDocShell->GetDocument();
1950 		if ( eFamily == SFX_STYLE_FAMILY_PARA )
1951 		{
1952 			//	Zeilenhoehen anpassen...
1953 
1954 			VirtualDevice aVDev;
1955 			Point aLogic = aVDev.LogicToPixel( Point(1000,1000), MAP_TWIP );
1956 			double nPPTX = aLogic.X() / 1000.0;
1957 			double nPPTY = aLogic.Y() / 1000.0;
1958 			Fraction aZoom(1,1);
1959 			pDoc->StyleSheetChanged( pStyle, sal_False, &aVDev, nPPTX, nPPTY, aZoom, aZoom );
1960 
1961 			pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT );
1962 			pDocShell->SetDocumentModified();
1963 		}
1964 		else
1965 		{
1966 			//!	ModifyStyleSheet am Dokument (alte Werte merken)
1967 
1968 			pDocShell->PageStyleModified( aStyleName, sal_True );
1969 		}
1970 	}
1971 }
1972 
1973 uno::Any SAL_CALL ScStyleObj::getPropertyValue( const rtl::OUString& aPropertyName )
1974 				throw(beans::UnknownPropertyException, lang::WrappedTargetException,
1975 						uno::RuntimeException)
1976 {
1977 	ScUnoGuard aGuard;
1978 	uno::Any aAny;
1979 
1980     if ( aPropertyName.equalsAscii( SC_UNONAME_DISPNAME ) )      // read-only
1981     {
1982         //  core always has the display name
1983         SfxStyleSheetBase* pStyle = GetStyle_Impl();
1984         if (pStyle)
1985             aAny <<= rtl::OUString( pStyle->GetName() );
1986     }
1987     else
1988     {
1989         const SfxItemPropertySimpleEntry* pResultEntry = NULL;
1990         const SfxItemSet* pItemSet = GetStyleItemSet_Impl( aPropertyName, pResultEntry );
1991 
1992         if ( pItemSet && pResultEntry )
1993         {
1994             sal_uInt16 nWhich = pResultEntry->nWID;
1995 
1996             if ( IsScItemWid( nWhich ) )
1997             {
1998                 switch ( nWhich )       // fuer Item-Spezial-Behandlungen
1999                 {
2000                     case ATTR_VALUE_FORMAT:
2001                         if ( pDocShell )
2002                         {
2003                             sal_uInt32 nOldFormat = ((const SfxUInt32Item&)
2004                                     pItemSet->Get( ATTR_VALUE_FORMAT )).GetValue();
2005                             LanguageType eOldLang = ((const SvxLanguageItem&)
2006                                     pItemSet->Get( ATTR_LANGUAGE_FORMAT )).GetLanguage();
2007                             nOldFormat = pDocShell->GetDocument()->GetFormatTable()->
2008                                     GetFormatForLanguageIfBuiltIn( nOldFormat, eOldLang );
2009                             aAny <<= nOldFormat;
2010                         }
2011                         break;
2012                     case ATTR_INDENT:
2013                         aAny <<= sal_Int16( TwipsToHMM(((const SfxUInt16Item&)
2014                                         pItemSet->Get(nWhich)).GetValue()) );
2015                         break;
2016                     case ATTR_STACKED:
2017                         {
2018                             sal_Int32 nRot = ((const SfxInt32Item&)pItemSet->Get(ATTR_ROTATE_VALUE)).GetValue();
2019                             sal_Bool bStacked = ((const SfxBoolItem&)pItemSet->Get(nWhich)).GetValue();
2020                             SvxOrientationItem( nRot, bStacked, 0 ).QueryValue( aAny );
2021                         }
2022                         break;
2023                     case ATTR_PAGE_SCALE:
2024                     case ATTR_PAGE_SCALETOPAGES:
2025                     case ATTR_PAGE_FIRSTPAGENO:
2026                         aAny <<= sal_Int16( ((const SfxUInt16Item&)pItemSet->Get(nWhich)).GetValue() );
2027                         break;
2028                     case ATTR_PAGE_CHARTS:
2029                     case ATTR_PAGE_OBJECTS:
2030                     case ATTR_PAGE_DRAWINGS:
2031                         //! sal_Bool-MID fuer ScViewObjectModeItem definieren?
2032                         aAny <<= sal_Bool( ((const ScViewObjectModeItem&)pItemSet->
2033                                         Get(nWhich)).GetValue() == VOBJ_MODE_SHOW );
2034                         break;
2035                     case ATTR_PAGE_PAPERBIN:
2036                         {
2037                             // property PrinterPaperTray is the name of the tray
2038 
2039                             sal_uInt8 nValue = ((const SvxPaperBinItem&)pItemSet->Get(nWhich)).GetValue();
2040                             rtl::OUString aName;
2041                             if ( nValue == PAPERBIN_PRINTER_SETTINGS )
2042                                 aName = rtl::OUString::createFromAscii( SC_PAPERBIN_DEFAULTNAME );
2043                             else
2044                             {
2045                                 Printer* pPrinter = pDocShell->GetPrinter();
2046                                 if (pPrinter)
2047                                     aName = pPrinter->GetPaperBinName( nValue );
2048                             }
2049                             aAny <<= aName;
2050                         }
2051                         break;
2052                     case ATTR_PAGE_SCALETO:
2053                         {
2054                             ScPageScaleToItem aItem((const ScPageScaleToItem&)pItemSet->Get(ATTR_PAGE_SCALETO));
2055                             if (aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SC_UNO_PAGE_SCALETOX)))
2056                                 aAny = uno::makeAny(static_cast<sal_Int16>(aItem.GetWidth()));
2057                             else
2058                                 aAny = uno::makeAny(static_cast<sal_Int16>(aItem.GetHeight()));
2059                         }
2060                         break;
2061                     default:
2062                         //  #65253# Default-Items mit falscher Slot-ID
2063                         //  funktionieren im SfxItemPropertySet3 nicht
2064                         //! Slot-IDs aendern...
2065                         if ( pItemSet->GetPool()->GetSlotId(nWhich) == nWhich &&
2066                              pItemSet->GetItemState(nWhich, sal_False) == SFX_ITEM_DEFAULT )
2067                         {
2068                             SfxItemSet aNoEmptySet( *pItemSet );
2069                             aNoEmptySet.Put( aNoEmptySet.Get( nWhich ) );
2070                             pPropSet->getPropertyValue( *pResultEntry, aNoEmptySet, aAny );
2071                         }
2072                         else
2073                             pPropSet->getPropertyValue( *pResultEntry, *pItemSet, aAny );
2074                 }
2075             }
2076             else if ( IsScUnoWid( nWhich ) )
2077             {
2078                 switch ( nWhich )
2079                 {
2080                     case SC_WID_UNO_TBLBORD:
2081                         {
2082                             const SfxPoolItem* pItem = &pItemSet->Get( ATTR_BORDER );
2083                             if ( pItem )
2084                             {
2085                                 SvxBoxItem aOuter( *( static_cast<const SvxBoxItem*>( pItem ) ) );
2086                                 SvxBoxInfoItem aInner( ATTR_BORDER_INNER );
2087                                 table::TableBorder aBorder;
2088                                 ScHelperFunctions::FillTableBorder( aBorder, aOuter, aInner );
2089                                 aBorder.IsHorizontalLineValid = sal_False;
2090                                 aBorder.IsVerticalLineValid = sal_False;
2091                                 aBorder.IsDistanceValid = sal_False;
2092                                 aAny <<= aBorder;
2093                             }
2094                         }
2095                         break;
2096                 }
2097             }
2098         }
2099     }
2100 
2101 	return aAny;
2102 }
2103 
2104 SC_IMPL_DUMMY_PROPERTY_LISTENER( ScStyleObj )
2105 
2106 // lang::XServiceInfo
2107 
2108 rtl::OUString SAL_CALL ScStyleObj::getImplementationName() throw(uno::RuntimeException)
2109 {
2110 	return rtl::OUString::createFromAscii( "ScStyleObj" );
2111 }
2112 
2113 sal_Bool SAL_CALL ScStyleObj::supportsService( const rtl::OUString& rServiceName )
2114 													throw(uno::RuntimeException)
2115 {
2116 	sal_Bool bPage = ( eFamily == SFX_STYLE_FAMILY_PAGE );
2117     return rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SCSTYLE_SERVICE ) )||
2118            rServiceName.equalsAsciiL(
2119             RTL_CONSTASCII_STRINGPARAM ( bPage ? SCPAGESTYLE_SERVICE : SCCELLSTYLE_SERVICE ));
2120 }
2121 
2122 uno::Sequence<rtl::OUString> SAL_CALL ScStyleObj::getSupportedServiceNames()
2123 													throw(uno::RuntimeException)
2124 {
2125 	sal_Bool bPage = ( eFamily == SFX_STYLE_FAMILY_PAGE );
2126 	uno::Sequence<rtl::OUString> aRet(2);
2127 	rtl::OUString* pArray = aRet.getArray();
2128 	pArray[0] = rtl::OUString::createFromAscii( SCSTYLE_SERVICE );
2129 	pArray[1] = rtl::OUString::createFromAscii( bPage ? SCPAGESTYLE_SERVICE
2130 													  : SCCELLSTYLE_SERVICE );
2131 	return aRet;
2132 }
2133 
2134 //------------------------------------------------------------------------
2135 
2136 
2137