merge the formfield patch from ooo-build
[ooovba.git] / sc / source / ui / unoobj / styleuno.cxx
blob7d002a0787aeefaba01b3e496e9fdda91f3151ba
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: styleuno.cxx,v $
10 * $Revision: 1.44.72.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
36 #include "scitems.hxx"
37 #include <svx/algitem.hxx>
38 #include <svx/boxitem.hxx>
39 #include <svx/langitem.hxx>
40 #include <svx/numitem.hxx>
41 #include <svx/pageitem.hxx>
42 #include <svx/pbinitem.hxx>
43 #include <svx/unomid.hxx>
44 #include <svx/unonrule.hxx>
45 #include <sfx2/bindings.hxx>
46 #include <sfx2/printer.hxx>
47 #include <vcl/virdev.hxx>
48 #include <svtools/itempool.hxx>
49 #include <svtools/itemset.hxx>
50 #include <svtools/intitem.hxx>
51 #include <svtools/zformat.hxx>
52 #include <rtl/uuid.h>
54 #include <com/sun/star/table/BorderLine.hpp>
55 #include <com/sun/star/table/CellVertJustify.hpp>
56 #include <com/sun/star/table/TableBorder.hpp>
57 #include <com/sun/star/table/ShadowFormat.hpp>
58 #include <com/sun/star/table/CellHoriJustify.hpp>
59 #include <com/sun/star/table/CellOrientation.hpp>
60 #include <com/sun/star/style/PageStyleLayout.hpp>
61 #include <com/sun/star/style/GraphicLocation.hpp>
62 #include <com/sun/star/sheet/XHeaderFooterContent.hpp>
63 #include <com/sun/star/util/CellProtection.hpp>
64 #include <com/sun/star/awt/FontSlant.hpp>
65 #include <com/sun/star/awt/Size.hpp>
66 #include <com/sun/star/lang/Locale.hpp>
67 #include <com/sun/star/beans/PropertyAttribute.hpp>
69 #include "styleuno.hxx"
70 #include "docsh.hxx"
71 #include "attrib.hxx"
72 #include "stlpool.hxx"
73 #include "unoguard.hxx"
74 #include "miscuno.hxx"
75 #include "convuno.hxx"
76 #include "tablink.hxx"
77 #include "unonames.hxx"
78 #include "unowids.hxx"
79 #include "globstr.hrc"
80 #include "cellsuno.hxx"
82 using namespace ::com::sun::star;
84 //------------------------------------------------------------------------
86 const SfxItemPropertySet* lcl_GetCellStyleSet()
88 static SfxItemPropertyMapEntry aCellStyleMap_Impl[] =
90 {MAP_CHAR_LEN(SC_UNONAME_ASIANVERT),ATTR_VERTICAL_ASIAN,&getBooleanCppuType(), 0, 0 },
91 {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
92 {MAP_CHAR_LEN(SC_UNONAME_CELLBACK), ATTR_BACKGROUND, &::getCppuType((const sal_Int32*)0), 0, MID_BACK_COLOR },
93 {MAP_CHAR_LEN(SC_UNONAME_CELLPRO), ATTR_PROTECTION, &::getCppuType((const util::CellProtection*)0), 0, 0 },
94 {MAP_CHAR_LEN(SC_UNONAME_CCOLOR), ATTR_FONT_COLOR, &::getCppuType((const sal_Int32*)0), 0, 0 },
95 {MAP_CHAR_LEN(SC_UNONAME_COUTL), ATTR_FONT_CONTOUR, &::getBooleanCppuType(), 0, 0 },
96 {MAP_CHAR_LEN(SC_UNONAME_CCROSS), ATTR_FONT_CROSSEDOUT,&::getBooleanCppuType(), 0, MID_CROSSED_OUT },
97 {MAP_CHAR_LEN(SC_UNONAME_CEMPHAS), ATTR_FONT_EMPHASISMARK,&getCppuType((sal_Int16*)0), 0, MID_EMPHASIS },
98 {MAP_CHAR_LEN(SC_UNONAME_CFONT), ATTR_FONT, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_FAMILY },
99 {MAP_CHAR_LEN(SC_UNONAME_CFCHARS), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
100 {MAP_CHAR_LEN(SC_UNO_CJK_CFCHARS), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
101 {MAP_CHAR_LEN(SC_UNO_CTL_CFCHARS), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_CHAR_SET },
102 {MAP_CHAR_LEN(SC_UNONAME_CFFAMIL), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
103 {MAP_CHAR_LEN(SC_UNO_CJK_CFFAMIL), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
104 {MAP_CHAR_LEN(SC_UNO_CTL_CFFAMIL), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_FAMILY },
105 {MAP_CHAR_LEN(SC_UNONAME_CFNAME), ATTR_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_FAMILY_NAME },
106 {MAP_CHAR_LEN(SC_UNO_CJK_CFNAME), ATTR_CJK_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_FAMILY_NAME },
107 {MAP_CHAR_LEN(SC_UNO_CTL_CFNAME), ATTR_CTL_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_FAMILY_NAME },
108 {MAP_CHAR_LEN(SC_UNONAME_CFPITCH), ATTR_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
109 {MAP_CHAR_LEN(SC_UNO_CJK_CFPITCH), ATTR_CJK_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
110 {MAP_CHAR_LEN(SC_UNO_CTL_CFPITCH), ATTR_CTL_FONT, &getCppuType((sal_Int16*)0), 0, MID_FONT_PITCH },
111 {MAP_CHAR_LEN(SC_UNONAME_CFSTYLE), ATTR_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_STYLE_NAME },
112 {MAP_CHAR_LEN(SC_UNO_CJK_CFSTYLE), ATTR_CJK_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_STYLE_NAME },
113 {MAP_CHAR_LEN(SC_UNO_CTL_CFSTYLE), ATTR_CTL_FONT, &getCppuType((rtl::OUString*)0), 0, MID_FONT_STYLE_NAME },
114 {MAP_CHAR_LEN(SC_UNONAME_CHEIGHT), ATTR_FONT_HEIGHT, &::getCppuType((const float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
115 {MAP_CHAR_LEN(SC_UNO_CJK_CHEIGHT), ATTR_CJK_FONT_HEIGHT,&::getCppuType((const float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
116 {MAP_CHAR_LEN(SC_UNO_CTL_CHEIGHT), ATTR_CTL_FONT_HEIGHT,&::getCppuType((const float*)0), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
117 {MAP_CHAR_LEN(SC_UNONAME_CLOCAL), ATTR_FONT_LANGUAGE, &::getCppuType((const lang::Locale*)0), 0, MID_LANG_LOCALE },
118 {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL), ATTR_CJK_FONT_LANGUAGE,&::getCppuType((const lang::Locale*)0), 0, MID_LANG_LOCALE },
119 {MAP_CHAR_LEN(SC_UNO_CTL_CLOCAL), ATTR_CTL_FONT_LANGUAGE,&::getCppuType((const lang::Locale*)0), 0, MID_LANG_LOCALE },
120 {MAP_CHAR_LEN(SC_UNONAME_COVER), ATTR_FONT_OVERLINE, &::getCppuType((const sal_Int16*)0), 0, MID_TL_STYLE },
121 {MAP_CHAR_LEN(SC_UNONAME_COVRLCOL), ATTR_FONT_OVERLINE, &getCppuType((sal_Int32*)0), 0, MID_TL_COLOR },
122 {MAP_CHAR_LEN(SC_UNONAME_COVRLHAS), ATTR_FONT_OVERLINE, &getBooleanCppuType(), 0, MID_TL_HASCOLOR },
123 {MAP_CHAR_LEN(SC_UNONAME_CPOST), ATTR_FONT_POSTURE, &::getCppuType((const awt::FontSlant*)0), 0, MID_POSTURE },
124 {MAP_CHAR_LEN(SC_UNO_CJK_CPOST), ATTR_CJK_FONT_POSTURE,&::getCppuType((const awt::FontSlant*)0), 0, MID_POSTURE },
125 {MAP_CHAR_LEN(SC_UNO_CTL_CPOST), ATTR_CTL_FONT_POSTURE,&::getCppuType((const awt::FontSlant*)0), 0, MID_POSTURE },
126 {MAP_CHAR_LEN(SC_UNONAME_CRELIEF), ATTR_FONT_RELIEF, &getCppuType((sal_Int16*)0), 0, MID_RELIEF },
127 {MAP_CHAR_LEN(SC_UNONAME_CSHADD), ATTR_FONT_SHADOWED, &::getBooleanCppuType(), 0, 0 },
128 {MAP_CHAR_LEN(SC_UNONAME_CSTRIKE), ATTR_FONT_CROSSEDOUT,&getCppuType((sal_Int16*)0), 0, MID_CROSS_OUT },
129 {MAP_CHAR_LEN(SC_UNONAME_CUNDER), ATTR_FONT_UNDERLINE,&::getCppuType((const sal_Int16*)0), 0, MID_TL_STYLE },
130 {MAP_CHAR_LEN(SC_UNONAME_CUNDLCOL), ATTR_FONT_UNDERLINE,&getCppuType((sal_Int32*)0), 0, MID_TL_COLOR },
131 {MAP_CHAR_LEN(SC_UNONAME_CUNDLHAS), ATTR_FONT_UNDERLINE,&getBooleanCppuType(), 0, MID_TL_HASCOLOR },
132 {MAP_CHAR_LEN(SC_UNONAME_CWEIGHT), ATTR_FONT_WEIGHT, &::getCppuType((const float*)0), 0, MID_WEIGHT },
133 {MAP_CHAR_LEN(SC_UNO_CJK_CWEIGHT), ATTR_CJK_FONT_WEIGHT,&::getCppuType((const float*)0), 0, MID_WEIGHT },
134 {MAP_CHAR_LEN(SC_UNO_CTL_CWEIGHT), ATTR_CTL_FONT_WEIGHT,&::getCppuType((const float*)0), 0, MID_WEIGHT },
135 {MAP_CHAR_LEN(SC_UNONAME_CWORDMOD), ATTR_FONT_WORDLINE, &getBooleanCppuType(), 0, 0 },
136 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR), ATTR_BORDER_BLTR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
137 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR), ATTR_BORDER_TLBR, &::getCppuType((const table::BorderLine*)0), 0, 0 | CONVERT_TWIPS },
138 {MAP_CHAR_LEN(SC_UNONAME_DISPNAME), SC_WID_UNO_DISPNAME,&::getCppuType((rtl::OUString*)0), beans::PropertyAttribute::READONLY, 0 },
139 {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS), ATTR_HOR_JUSTIFY, &::getCppuType((const table::CellHoriJustify*)0), 0, MID_HORJUST_HORJUST },
140 {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN), ATTR_BACKGROUND, &::getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT },
141 {MAP_CHAR_LEN(SC_UNONAME_WRAP), ATTR_LINEBREAK, &::getBooleanCppuType(), 0, 0 },
142 {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
143 {MAP_CHAR_LEN(SC_UNONAME_NUMFMT), ATTR_VALUE_FORMAT, &::getCppuType((const sal_Int32*)0), 0, 0 },
144 // {MAP_CHAR_LEN(SC_UNONAME_NUMRULES), SC_WID_UNO_NUMRULES,&getCppuType((const uno::Reference<container::XIndexReplace>*)0), 0, 0 },
145 {MAP_CHAR_LEN(SC_UNONAME_CELLORI), ATTR_STACKED, &::getCppuType((const table::CellOrientation*)0), 0, 0 },
146 {MAP_CHAR_LEN(SC_UNONAME_PADJUST), ATTR_HOR_JUSTIFY, &::getCppuType((const sal_Int16*)0), 0, MID_HORJUST_ADJUST },
147 {MAP_CHAR_LEN(SC_UNONAME_PBMARGIN), ATTR_MARGIN, &::getCppuType((const sal_Int32*)0), 0, MID_MARGIN_LO_MARGIN | CONVERT_TWIPS },
148 {MAP_CHAR_LEN(SC_UNONAME_PINDENT), ATTR_INDENT, &::getCppuType((const sal_Int16*)0), 0, 0 }, //! CONVERT_TWIPS
149 {MAP_CHAR_LEN(SC_UNONAME_PISCHDIST),ATTR_SCRIPTSPACE, &::getBooleanCppuType(), 0, 0 },
150 {MAP_CHAR_LEN(SC_UNONAME_PISFORBID),ATTR_FORBIDDEN_RULES,&::getBooleanCppuType(), 0, 0 },
151 {MAP_CHAR_LEN(SC_UNONAME_PISHANG), ATTR_HANGPUNCTUATION,&::getBooleanCppuType(), 0, 0 },
152 {MAP_CHAR_LEN(SC_UNONAME_PISHYPHEN),ATTR_HYPHENATE, &getBooleanCppuType(), 0, 0 },
153 {MAP_CHAR_LEN(SC_UNONAME_PLASTADJ), ATTR_HOR_JUSTIFY, &::getCppuType((const sal_Int16*)0), 0, MID_HORJUST_ADJUST },
154 {MAP_CHAR_LEN(SC_UNONAME_PLMARGIN), ATTR_MARGIN, &::getCppuType((const sal_Int32*)0), 0, MID_MARGIN_L_MARGIN | CONVERT_TWIPS },
155 {MAP_CHAR_LEN(SC_UNONAME_PRMARGIN), ATTR_MARGIN, &::getCppuType((const sal_Int32*)0), 0, MID_MARGIN_R_MARGIN | CONVERT_TWIPS },
156 {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN), ATTR_MARGIN, &::getCppuType((const sal_Int32*)0), 0, MID_MARGIN_UP_MARGIN | CONVERT_TWIPS },
157 {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
158 {MAP_CHAR_LEN(SC_UNONAME_ROTANG), ATTR_ROTATE_VALUE, &::getCppuType((const sal_Int32*)0), 0, 0 },
159 {MAP_CHAR_LEN(SC_UNONAME_ROTREF), ATTR_ROTATE_MODE, &::getCppuType((const table::CellVertJustify*)0), 0, 0 },
160 {MAP_CHAR_LEN(SC_UNONAME_SHADOW), ATTR_SHADOW, &::getCppuType((const table::ShadowFormat*)0), 0, 0 | CONVERT_TWIPS },
161 {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT), ATTR_SHRINKTOFIT, &getBooleanCppuType(), 0, 0 },
162 {MAP_CHAR_LEN(SC_UNONAME_TBLBORD), SC_WID_UNO_TBLBORD, &::getCppuType((const table::TableBorder*)0), 0, 0 | CONVERT_TWIPS },
163 {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER),ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, TOP_BORDER | CONVERT_TWIPS },
164 {MAP_CHAR_LEN(SC_UNONAME_USERDEF), ATTR_USERDEF, &getCppuType((uno::Reference<container::XNameContainer>*)0), 0, 0 },
165 {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS), ATTR_VER_JUSTIFY, &::getCppuType((const table::CellVertJustify*)0), 0, 0 },
166 {MAP_CHAR_LEN(SC_UNONAME_WRITING), ATTR_WRITINGDIR, &getCppuType((sal_Int16*)0), 0, 0 },
167 {0,0,0,0,0,0}
169 static SfxItemPropertySet aCellStyleSet_Impl( aCellStyleMap_Impl );
170 return &aCellStyleSet_Impl;
173 // Map mit allen Seitenattributen, incl. Kopf-/Fusszeilenattribute
175 const SfxItemPropertySet * lcl_GetPageStyleSet()
177 static SfxItemPropertyMapEntry aPageStyleMap_Impl[] =
179 {MAP_CHAR_LEN(SC_UNO_PAGE_BACKCOLOR), ATTR_BACKGROUND, &::getCppuType((const sal_Int32*)0), 0, MID_BACK_COLOR },
180 {MAP_CHAR_LEN(SC_UNO_PAGE_GRAPHICFILT), ATTR_BACKGROUND, &::getCppuType((const ::rtl::OUString*)0), 0, MID_GRAPHIC_FILTER },
181 {MAP_CHAR_LEN(SC_UNO_PAGE_GRAPHICLOC), ATTR_BACKGROUND, &::getCppuType((const style::GraphicLocation*)0), 0, MID_GRAPHIC_POSITION },
182 {MAP_CHAR_LEN(SC_UNO_PAGE_GRAPHICURL), ATTR_BACKGROUND, &::getCppuType((const ::rtl::OUString*)0), 0, MID_GRAPHIC_URL },
183 {MAP_CHAR_LEN(SC_UNO_PAGE_BACKTRANS), ATTR_BACKGROUND, &::getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT },
184 {MAP_CHAR_LEN(OLD_UNO_PAGE_BACKCOLOR), ATTR_BACKGROUND, &::getCppuType((const sal_Int32*)0), 0, MID_BACK_COLOR },
185 {MAP_CHAR_LEN(SC_UNO_PAGE_BORDERDIST), ATTR_BORDER, &::getCppuType((const sal_Int32*)0), 0, BORDER_DISTANCE | CONVERT_TWIPS },
186 {MAP_CHAR_LEN(SC_UNO_PAGE_BOTTBORDER), ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
187 {MAP_CHAR_LEN(SC_UNO_PAGE_BOTTBRDDIST), ATTR_BORDER, &::getCppuType((const sal_Int32*)0), 0, BOTTOM_BORDER_DISTANCE | CONVERT_TWIPS },
188 {MAP_CHAR_LEN(SC_UNO_PAGE_BOTTMARGIN), ATTR_ULSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_LO_MARGIN | CONVERT_TWIPS },
189 {MAP_CHAR_LEN(SC_UNO_PAGE_CENTERHOR), ATTR_PAGE_HORCENTER,&::getBooleanCppuType(), 0, 0 },
190 {MAP_CHAR_LEN(SC_UNO_PAGE_CENTERVER), ATTR_PAGE_VERCENTER,&::getBooleanCppuType(), 0, 0 },
191 {MAP_CHAR_LEN(SC_UNONAME_DISPNAME), SC_WID_UNO_DISPNAME,&::getCppuType((rtl::OUString*)0), beans::PropertyAttribute::READONLY, 0 },
192 {MAP_CHAR_LEN(SC_UNO_PAGE_FIRSTPAGE), ATTR_PAGE_FIRSTPAGENO,&::getCppuType((const sal_Int16*)0), 0, 0 },
194 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRBACKCOL), SC_WID_UNO_FOOTERSET,&::getCppuType((const sal_Int32*)0), 0, 0 },
195 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFFILT), SC_WID_UNO_FOOTERSET,&::getCppuType((const ::rtl::OUString*)0), 0, 0 },
196 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFLOC), SC_WID_UNO_FOOTERSET,&::getCppuType((const style::GraphicLocation*)0), 0, 0 },
197 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFURL), SC_WID_UNO_FOOTERSET,&::getCppuType((const ::rtl::OUString*)0), 0, 0 },
198 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRBACKTRAN), SC_WID_UNO_FOOTERSET,&::getBooleanCppuType(), 0, 0 },
199 {MAP_CHAR_LEN(OLD_UNO_PAGE_FTRBACKCOL), SC_WID_UNO_FOOTERSET,&::getCppuType((const sal_Int32*)0), 0, 0 },
200 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRBODYDIST), SC_WID_UNO_FOOTERSET,&::getCppuType((const sal_Int32*)0), 0, 0 },
201 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRBRDDIST), SC_WID_UNO_FOOTERSET,&::getCppuType((const sal_Int32*)0), 0, 0 },
202 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRBOTTBOR), SC_WID_UNO_FOOTERSET,&::getCppuType((const table::BorderLine*)0), 0, 0 },
203 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRBOTTBDIS), SC_WID_UNO_FOOTERSET,&::getCppuType((const sal_Int32*)0), 0, 0 },
204 {MAP_CHAR_LEN(OLD_UNO_PAGE_FTRDYNAMIC), SC_WID_UNO_FOOTERSET,&::getBooleanCppuType(), 0, 0 },
205 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRHEIGHT), SC_WID_UNO_FOOTERSET,&::getCppuType((const sal_Int32*)0), 0, 0 },
206 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRDYNAMIC), SC_WID_UNO_FOOTERSET,&::getBooleanCppuType(), 0, 0 },
207 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRON), SC_WID_UNO_FOOTERSET,&::getBooleanCppuType(), 0, 0 },
208 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRSHARED), SC_WID_UNO_FOOTERSET,&::getBooleanCppuType(), 0, 0 },
209 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTBOR), SC_WID_UNO_FOOTERSET,&::getCppuType((const table::BorderLine*)0), 0, 0 },
210 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTBDIS), SC_WID_UNO_FOOTERSET,&::getCppuType((const sal_Int32*)0), 0, 0 },
211 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTMAR), SC_WID_UNO_FOOTERSET,&::getCppuType((const sal_Int32*)0), 0, 0 },
212 {MAP_CHAR_LEN(OLD_UNO_PAGE_FTRON), SC_WID_UNO_FOOTERSET,&::getBooleanCppuType(), 0, 0 },
213 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTBOR), SC_WID_UNO_FOOTERSET,&::getCppuType((const table::BorderLine*)0), 0, 0 },
214 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTBDIS),SC_WID_UNO_FOOTERSET,&::getCppuType((const sal_Int32*)0), 0, 0 },
215 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTMAR), SC_WID_UNO_FOOTERSET,&::getCppuType((const sal_Int32*)0), 0, 0 },
216 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRSHADOW), SC_WID_UNO_FOOTERSET,&::getCppuType((const table::ShadowFormat*)0), 0, 0 },
217 {MAP_CHAR_LEN(OLD_UNO_PAGE_FTRSHARED), SC_WID_UNO_FOOTERSET,&::getBooleanCppuType(), 0, 0 },
218 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRTOPBOR), SC_WID_UNO_FOOTERSET,&::getCppuType((const table::BorderLine*)0), 0, 0 },
219 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRTOPBDIS), SC_WID_UNO_FOOTERSET,&::getCppuType((const sal_Int32*)0), 0, 0 },
221 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRBACKCOL), SC_WID_UNO_HEADERSET,&::getCppuType((const sal_Int32*)0), 0, 0 },
222 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFFILT), SC_WID_UNO_HEADERSET,&::getCppuType((const ::rtl::OUString*)0), 0, 0 },
223 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFLOC), SC_WID_UNO_HEADERSET,&::getCppuType((const style::GraphicLocation*)0), 0, 0 },
224 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFURL), SC_WID_UNO_HEADERSET,&::getCppuType((const ::rtl::OUString*)0), 0, 0 },
225 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRBACKTRAN), SC_WID_UNO_HEADERSET,&::getBooleanCppuType(), 0, 0 },
226 {MAP_CHAR_LEN(OLD_UNO_PAGE_HDRBACKCOL), SC_WID_UNO_HEADERSET,&::getCppuType((const sal_Int32*)0), 0, 0 },
227 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRBODYDIST), SC_WID_UNO_HEADERSET,&::getCppuType((const sal_Int32*)0), 0, 0 },
228 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRBRDDIST), SC_WID_UNO_HEADERSET,&::getCppuType((const sal_Int32*)0), 0, 0 },
229 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRBOTTBOR), SC_WID_UNO_HEADERSET,&::getCppuType((const table::BorderLine*)0), 0, 0 },
230 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRBOTTBDIS), SC_WID_UNO_HEADERSET,&::getCppuType((const sal_Int32*)0), 0, 0 },
231 {MAP_CHAR_LEN(OLD_UNO_PAGE_HDRDYNAMIC), SC_WID_UNO_HEADERSET,&::getBooleanCppuType(), 0, 0 },
232 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRHEIGHT), SC_WID_UNO_HEADERSET,&::getCppuType((const sal_Int32*)0), 0, 0 },
233 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRDYNAMIC), SC_WID_UNO_HEADERSET,&::getBooleanCppuType(), 0, 0 },
234 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRON), SC_WID_UNO_HEADERSET,&::getBooleanCppuType(), 0, 0 },
235 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRSHARED), SC_WID_UNO_HEADERSET,&::getBooleanCppuType(), 0, 0 },
236 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTBOR), SC_WID_UNO_HEADERSET,&::getCppuType((const table::BorderLine*)0), 0, 0 },
237 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTBDIS), SC_WID_UNO_HEADERSET,&::getCppuType((const sal_Int32*)0), 0, 0 },
238 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTMAR), SC_WID_UNO_HEADERSET,&::getCppuType((const sal_Int32*)0), 0, 0 },
239 {MAP_CHAR_LEN(OLD_UNO_PAGE_HDRON), SC_WID_UNO_HEADERSET,&::getBooleanCppuType(), 0, 0 },
240 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTBOR), SC_WID_UNO_HEADERSET,&::getCppuType((const table::BorderLine*)0), 0, 0 },
241 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTBDIS),SC_WID_UNO_HEADERSET,&::getCppuType((const sal_Int32*)0), 0, 0 },
242 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTMAR), SC_WID_UNO_HEADERSET,&::getCppuType((const sal_Int32*)0), 0, 0 },
243 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRSHADOW), SC_WID_UNO_HEADERSET,&::getCppuType((const table::ShadowFormat*)0), 0, 0 },
244 {MAP_CHAR_LEN(OLD_UNO_PAGE_HDRSHARED), SC_WID_UNO_HEADERSET,&::getBooleanCppuType(), 0, 0 },
245 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRTOPBOR), SC_WID_UNO_HEADERSET,&::getCppuType((const table::BorderLine*)0), 0, 0 },
246 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRTOPBDIS), SC_WID_UNO_HEADERSET,&::getCppuType((const sal_Int32*)0), 0, 0 },
248 {MAP_CHAR_LEN(SC_UNO_PAGE_HEIGHT), ATTR_PAGE_SIZE, &::getCppuType((const sal_Int32*)0), 0, MID_SIZE_HEIGHT | CONVERT_TWIPS },
249 {MAP_CHAR_LEN(OLD_UNO_PAGE_BACKTRANS), ATTR_BACKGROUND, &::getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT },
250 {MAP_CHAR_LEN(SC_UNO_PAGE_LANDSCAPE), ATTR_PAGE, &::getBooleanCppuType(), 0, MID_PAGE_ORIENTATION },
251 {MAP_CHAR_LEN(SC_UNO_PAGE_LEFTBORDER), ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
252 {MAP_CHAR_LEN(SC_UNO_PAGE_LEFTBRDDIST), ATTR_BORDER, &::getCppuType((const sal_Int32*)0), 0, LEFT_BORDER_DISTANCE | CONVERT_TWIPS },
253 {MAP_CHAR_LEN(SC_UNO_PAGE_LEFTMARGIN), ATTR_LRSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_L_MARGIN | CONVERT_TWIPS },
254 {MAP_CHAR_LEN(SC_UNO_PAGE_LEFTFTRCONT), ATTR_PAGE_FOOTERLEFT,&::getCppuType((const uno::Reference< sheet::XHeaderFooterContent >*)0), 0, 0 },
255 {MAP_CHAR_LEN(SC_UNO_PAGE_LEFTHDRCONT), ATTR_PAGE_HEADERLEFT,&::getCppuType((const uno::Reference< sheet::XHeaderFooterContent >*)0), 0, 0 },
256 {MAP_CHAR_LEN(SC_UNO_PAGE_NUMBERTYPE), ATTR_PAGE, &::getCppuType((const sal_Int16*)0), 0, MID_PAGE_NUMTYPE },
257 {MAP_CHAR_LEN(SC_UNO_PAGE_SCALEVAL), ATTR_PAGE_SCALE, &::getCppuType((const sal_Int16*)0), 0, 0 },
258 {MAP_CHAR_LEN(SC_UNO_PAGE_SYTLELAYOUT), ATTR_PAGE, &::getCppuType((const style::PageStyleLayout*)0), 0, MID_PAGE_LAYOUT },
259 {MAP_CHAR_LEN(SC_UNO_PAGE_PRINTANNOT), ATTR_PAGE_NOTES, &::getBooleanCppuType(), 0, 0 },
260 {MAP_CHAR_LEN(SC_UNO_PAGE_PRINTCHARTS), ATTR_PAGE_CHARTS, &::getBooleanCppuType(), 0, 0 },
261 {MAP_CHAR_LEN(SC_UNO_PAGE_PRINTDOWN), ATTR_PAGE_TOPDOWN, &::getBooleanCppuType(), 0, 0 },
262 {MAP_CHAR_LEN(SC_UNO_PAGE_PRINTDRAW), ATTR_PAGE_DRAWINGS, &::getBooleanCppuType(), 0, 0 },
263 {MAP_CHAR_LEN(SC_UNO_PAGE_PRINTFORMUL), ATTR_PAGE_FORMULAS, &::getBooleanCppuType(), 0, 0 },
264 {MAP_CHAR_LEN(SC_UNO_PAGE_PRINTGRID), ATTR_PAGE_GRID, &::getBooleanCppuType(), 0, 0 },
265 {MAP_CHAR_LEN(SC_UNO_PAGE_PRINTHEADER), ATTR_PAGE_HEADERS, &::getBooleanCppuType(), 0, 0 },
266 {MAP_CHAR_LEN(SC_UNO_PAGE_PRINTOBJS), ATTR_PAGE_OBJECTS, &::getBooleanCppuType(), 0, 0 },
267 {MAP_CHAR_LEN(SC_UNO_PAGE_PRINTZERO), ATTR_PAGE_NULLVALS, &::getBooleanCppuType(), 0, 0 },
268 {MAP_CHAR_LEN(SC_UNO_PAGE_PAPERTRAY), ATTR_PAGE_PAPERBIN, &::getCppuType((const ::rtl::OUString*)0), 0, 0 },
269 {MAP_CHAR_LEN(SC_UNO_PAGE_RIGHTBORDER), ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
270 {MAP_CHAR_LEN(SC_UNO_PAGE_RIGHTBRDDIST),ATTR_BORDER, &::getCppuType((const sal_Int32*)0), 0, RIGHT_BORDER_DISTANCE | CONVERT_TWIPS },
271 {MAP_CHAR_LEN(SC_UNO_PAGE_RIGHTMARGIN), ATTR_LRSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_R_MARGIN | CONVERT_TWIPS },
272 {MAP_CHAR_LEN(SC_UNO_PAGE_RIGHTFTRCON), ATTR_PAGE_FOOTERRIGHT,&::getCppuType((const uno::Reference< sheet::XHeaderFooterContent >*)0), 0, 0 },
273 {MAP_CHAR_LEN(SC_UNO_PAGE_RIGHTHDRCON), ATTR_PAGE_HEADERRIGHT,&::getCppuType((const uno::Reference< sheet::XHeaderFooterContent >*)0), 0, 0 },
274 {MAP_CHAR_LEN(SC_UNO_PAGE_SCALETOPAG), ATTR_PAGE_SCALETOPAGES,&::getCppuType((const sal_Int16*)0), 0, 0 },
275 {MAP_CHAR_LEN(SC_UNO_PAGE_SCALETOX), ATTR_PAGE_SCALETO, &::getCppuType((const sal_Int16*)0), 0, 0 },
276 {MAP_CHAR_LEN(SC_UNO_PAGE_SCALETOY), ATTR_PAGE_SCALETO, &::getCppuType((const sal_Int16*)0), 0, 0 },
277 {MAP_CHAR_LEN(SC_UNO_PAGE_SHADOWFORM), ATTR_SHADOW, &::getCppuType((const table::ShadowFormat*)0), 0, 0 | CONVERT_TWIPS },
278 {MAP_CHAR_LEN(SC_UNO_PAGE_SIZE), ATTR_PAGE_SIZE, &::getCppuType((const awt::Size*)0), 0, MID_SIZE_SIZE | CONVERT_TWIPS },
279 {MAP_CHAR_LEN(SC_UNO_PAGE_TOPBORDER), ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, TOP_BORDER | CONVERT_TWIPS },
280 {MAP_CHAR_LEN(SC_UNO_PAGE_TOPBRDDIST), ATTR_BORDER, &::getCppuType((const sal_Int32*)0), 0, TOP_BORDER_DISTANCE | CONVERT_TWIPS },
281 {MAP_CHAR_LEN(SC_UNO_PAGE_TOPMARGIN), ATTR_ULSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_UP_MARGIN | CONVERT_TWIPS },
282 {MAP_CHAR_LEN(OLD_UNO_PAGE_FTRBACKTRAN),SC_WID_UNO_FOOTERSET,&::getBooleanCppuType(), 0, 0 },
283 {MAP_CHAR_LEN(OLD_UNO_PAGE_HDRBACKTRAN),SC_WID_UNO_HEADERSET,&::getBooleanCppuType(), 0, 0 },
284 {MAP_CHAR_LEN(SC_UNONAME_USERDEF), ATTR_USERDEF, &getCppuType((uno::Reference<container::XNameContainer>*)0), 0, 0 },
285 {MAP_CHAR_LEN(SC_UNO_PAGE_WIDTH), ATTR_PAGE_SIZE, &::getCppuType((const sal_Int32*)0), 0, MID_SIZE_WIDTH | CONVERT_TWIPS },
286 {MAP_CHAR_LEN(SC_UNONAME_WRITING), ATTR_WRITINGDIR, &getCppuType((sal_Int16*)0), 0, 0 },
287 {0,0,0,0,0,0}
289 static SfxItemPropertySet aPageStyleSet_Impl( aPageStyleMap_Impl );
290 return &aPageStyleSet_Impl;
293 // Map mit Inhalten des Header-Item-Sets
295 const SfxItemPropertyMap* lcl_GetHeaderStyleMap()
297 static SfxItemPropertyMapEntry aHeaderStyleMap_Impl[] =
299 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRBACKCOL), ATTR_BACKGROUND, &::getCppuType((const sal_Int32*)0), 0, MID_BACK_COLOR },
300 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFFILT), ATTR_BACKGROUND, &::getCppuType((const ::rtl::OUString*)0), 0, MID_GRAPHIC_FILTER },
301 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFLOC), ATTR_BACKGROUND, &::getCppuType((const style::GraphicLocation*)0), 0, MID_GRAPHIC_POSITION },
302 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFURL), ATTR_BACKGROUND, &::getCppuType((const ::rtl::OUString*)0), 0, MID_GRAPHIC_URL },
303 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRBACKTRAN), ATTR_BACKGROUND, &::getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT },
304 {MAP_CHAR_LEN(OLD_UNO_PAGE_HDRBACKCOL), ATTR_BACKGROUND, &::getCppuType((const sal_Int32*)0), 0, MID_BACK_COLOR },
305 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRBODYDIST), ATTR_ULSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_LO_MARGIN | CONVERT_TWIPS },
306 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRBRDDIST), ATTR_BORDER, &::getCppuType((const sal_Int32*)0), 0, BORDER_DISTANCE | CONVERT_TWIPS },
307 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRBOTTBOR), ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
308 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRBOTTBDIS), ATTR_BORDER, &::getCppuType((const sal_Int32*)0), 0, BOTTOM_BORDER_DISTANCE | CONVERT_TWIPS },
309 {MAP_CHAR_LEN(OLD_UNO_PAGE_HDRDYNAMIC), ATTR_PAGE_DYNAMIC, &::getBooleanCppuType(), 0, 0 },
310 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRHEIGHT), ATTR_PAGE_SIZE, &::getCppuType((const sal_Int32*)0), 0, MID_SIZE_HEIGHT | CONVERT_TWIPS },
311 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRDYNAMIC), ATTR_PAGE_DYNAMIC, &::getBooleanCppuType(), 0, 0 },
312 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRON), ATTR_PAGE_ON, &::getBooleanCppuType(), 0, 0 },
313 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRSHARED), ATTR_PAGE_SHARED, &::getBooleanCppuType(), 0, 0 },
314 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTBOR), ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
315 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTBDIS), ATTR_BORDER, &::getCppuType((const sal_Int32*)0), 0, LEFT_BORDER_DISTANCE | CONVERT_TWIPS },
316 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTMAR), ATTR_LRSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_L_MARGIN | CONVERT_TWIPS },
317 {MAP_CHAR_LEN(OLD_UNO_PAGE_HDRON), ATTR_PAGE_ON, &::getBooleanCppuType(), 0, 0 },
318 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTBOR), ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
319 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTBDIS),ATTR_BORDER, &::getCppuType((const sal_Int32*)0), 0, RIGHT_BORDER_DISTANCE | CONVERT_TWIPS },
320 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTMAR), ATTR_LRSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_R_MARGIN | CONVERT_TWIPS },
321 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRSHADOW), ATTR_SHADOW, &::getCppuType((const table::ShadowFormat*)0), 0, 0 | CONVERT_TWIPS },
322 {MAP_CHAR_LEN(OLD_UNO_PAGE_HDRSHARED), ATTR_PAGE_SHARED, &::getBooleanCppuType(), 0, 0 },
323 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRTOPBOR), ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, TOP_BORDER | CONVERT_TWIPS },
324 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRTOPBDIS), ATTR_BORDER, &::getCppuType((const sal_Int32*)0), 0, TOP_BORDER_DISTANCE | CONVERT_TWIPS },
325 {MAP_CHAR_LEN(OLD_UNO_PAGE_HDRBACKTRAN),ATTR_BACKGROUND, &::getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT },
326 {0,0,0,0,0,0}
328 static SfxItemPropertyMap aHeaderStyleMap( aHeaderStyleMap_Impl );
329 return &aHeaderStyleMap;
332 // Map mit Inhalten des Footer-Item-Sets
334 const SfxItemPropertyMap* lcl_GetFooterStyleMap()
336 static SfxItemPropertyMapEntry aFooterStyleMap_Impl[] =
338 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRBACKCOL), ATTR_BACKGROUND, &::getCppuType((const sal_Int32*)0), 0, MID_BACK_COLOR },
339 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFFILT), ATTR_BACKGROUND, &::getCppuType((const ::rtl::OUString*)0), 0, MID_GRAPHIC_FILTER },
340 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFLOC), ATTR_BACKGROUND, &::getCppuType((const style::GraphicLocation*)0), 0, MID_GRAPHIC_POSITION },
341 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFURL), ATTR_BACKGROUND, &::getCppuType((const ::rtl::OUString*)0), 0, MID_GRAPHIC_URL },
342 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRBACKTRAN), ATTR_BACKGROUND, &::getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT },
343 {MAP_CHAR_LEN(OLD_UNO_PAGE_FTRBACKCOL), ATTR_BACKGROUND, &::getCppuType((const sal_Int32*)0), 0, MID_BACK_COLOR },
344 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRBODYDIST), ATTR_ULSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_UP_MARGIN | CONVERT_TWIPS },
345 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRBRDDIST), ATTR_BORDER, &::getCppuType((const sal_Int32*)0), 0, BORDER_DISTANCE | CONVERT_TWIPS },
346 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRBOTTBOR), ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, BOTTOM_BORDER | CONVERT_TWIPS },
347 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRBOTTBDIS), ATTR_BORDER, &::getCppuType((const sal_Int32*)0), 0, BOTTOM_BORDER_DISTANCE | CONVERT_TWIPS },
348 {MAP_CHAR_LEN(OLD_UNO_PAGE_FTRDYNAMIC), ATTR_PAGE_DYNAMIC, &::getBooleanCppuType(), 0, 0 },
349 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRHEIGHT), ATTR_PAGE_SIZE, &::getCppuType((const sal_Int32*)0), 0, MID_SIZE_HEIGHT | CONVERT_TWIPS },
350 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRDYNAMIC), ATTR_PAGE_DYNAMIC, &::getBooleanCppuType(), 0, 0 },
351 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRON), ATTR_PAGE_ON, &::getBooleanCppuType(), 0, 0 },
352 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRSHARED), ATTR_PAGE_SHARED, &::getBooleanCppuType(), 0, 0 },
353 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTBOR), ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, LEFT_BORDER | CONVERT_TWIPS },
354 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTBDIS), ATTR_BORDER, &::getCppuType((const sal_Int32*)0), 0, LEFT_BORDER_DISTANCE | CONVERT_TWIPS },
355 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTMAR), ATTR_LRSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_L_MARGIN | CONVERT_TWIPS },
356 {MAP_CHAR_LEN(OLD_UNO_PAGE_FTRON), ATTR_PAGE_ON, &::getBooleanCppuType(), 0, 0 },
357 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTBOR), ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, RIGHT_BORDER | CONVERT_TWIPS },
358 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTBDIS),ATTR_BORDER, &::getCppuType((const sal_Int32*)0), 0, RIGHT_BORDER_DISTANCE | CONVERT_TWIPS },
359 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTMAR), ATTR_LRSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_R_MARGIN | CONVERT_TWIPS },
360 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRSHADOW), ATTR_SHADOW, &::getCppuType((const table::ShadowFormat*)0), 0, 0 | CONVERT_TWIPS },
361 {MAP_CHAR_LEN(OLD_UNO_PAGE_FTRSHARED), ATTR_PAGE_SHARED, &::getBooleanCppuType(), 0, 0 },
362 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRTOPBOR), ATTR_BORDER, &::getCppuType((const table::BorderLine*)0), 0, TOP_BORDER | CONVERT_TWIPS },
363 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRTOPBDIS), ATTR_BORDER, &::getCppuType((const sal_Int32*)0), 0, TOP_BORDER_DISTANCE | CONVERT_TWIPS },
364 {MAP_CHAR_LEN(OLD_UNO_PAGE_FTRBACKTRAN),ATTR_BACKGROUND, &::getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT },
365 {0,0,0,0,0,0}
367 static SfxItemPropertyMap aFooterStyleMap( aFooterStyleMap_Impl );
368 return &aFooterStyleMap;
372 //------------------------------------------------------------------------
374 // Index-Access auf die Style-Typen: 0 = Cell, 1 = Page
376 #define SC_STYLE_FAMILY_COUNT 2
378 #define SC_FAMILYNAME_CELL "CellStyles"
379 #define SC_FAMILYNAME_PAGE "PageStyles"
381 static UINT16 aStyleFamilyTypes[SC_STYLE_FAMILY_COUNT] = { SFX_STYLE_FAMILY_PARA, SFX_STYLE_FAMILY_PAGE };
383 //------------------------------------------------------------------------
385 //! diese Funktionen in einen allgemeinen Header verschieben
386 inline long TwipsToHMM(long nTwips) { return (nTwips * 127 + 36) / 72; }
387 inline long HMMToTwips(long nHMM) { return (nHMM * 72 + 63) / 127; }
389 //------------------------------------------------------------------------
391 #define SCSTYLE_SERVICE "com.sun.star.style.Style"
392 #define SCCELLSTYLE_SERVICE "com.sun.star.style.CellStyle"
393 #define SCPAGESTYLE_SERVICE "com.sun.star.style.PageStyle"
395 SC_SIMPLE_SERVICE_INFO( ScStyleFamiliesObj, "ScStyleFamiliesObj", "com.sun.star.style.StyleFamilies" )
396 SC_SIMPLE_SERVICE_INFO( ScStyleFamilyObj, "ScStyleFamilyObj", "com.sun.star.style.StyleFamily" )
398 //------------------------------------------------------------------------
400 #define SC_PAPERBIN_DEFAULTNAME "[From printer settings]"
402 //------------------------------------------------------------------------
404 // conversion programmatic <-> display (visible) name
405 // currently, the core always has the visible names
406 // the api is required to use programmatic names for default styles
407 // these programmatic names must never change!
409 #define SC_STYLE_PROG_STANDARD "Default"
410 #define SC_STYLE_PROG_RESULT "Result"
411 #define SC_STYLE_PROG_RESULT1 "Result2"
412 #define SC_STYLE_PROG_HEADLINE "Heading"
413 #define SC_STYLE_PROG_HEADLINE1 "Heading1"
414 #define SC_STYLE_PROG_REPORT "Report"
416 struct ScDisplayNameMap
418 String aDispName;
419 String aProgName;
422 const ScDisplayNameMap* lcl_GetStyleNameMap( UINT16 nType )
424 if ( nType == SFX_STYLE_FAMILY_PARA )
426 static BOOL bCellMapFilled = FALSE;
427 static ScDisplayNameMap aCellMap[6];
428 if ( !bCellMapFilled )
430 aCellMap[0].aDispName = ScGlobal::GetRscString( STR_STYLENAME_STANDARD );
431 aCellMap[0].aProgName = String::CreateFromAscii( SC_STYLE_PROG_STANDARD );
433 aCellMap[1].aDispName = ScGlobal::GetRscString( STR_STYLENAME_RESULT );
434 aCellMap[1].aProgName = String::CreateFromAscii( SC_STYLE_PROG_RESULT );
436 aCellMap[2].aDispName = ScGlobal::GetRscString( STR_STYLENAME_RESULT1 );
437 aCellMap[2].aProgName = String::CreateFromAscii( SC_STYLE_PROG_RESULT1 );
439 aCellMap[3].aDispName = ScGlobal::GetRscString( STR_STYLENAME_HEADLINE );
440 aCellMap[3].aProgName = String::CreateFromAscii( SC_STYLE_PROG_HEADLINE );
442 aCellMap[4].aDispName = ScGlobal::GetRscString( STR_STYLENAME_HEADLINE1 );
443 aCellMap[4].aProgName = String::CreateFromAscii( SC_STYLE_PROG_HEADLINE1 );
445 // last entry remains empty
447 bCellMapFilled = TRUE;
449 return aCellMap;
451 else if ( nType == SFX_STYLE_FAMILY_PAGE )
453 static BOOL bPageMapFilled = FALSE;
454 static ScDisplayNameMap aPageMap[3];
455 if ( !bPageMapFilled )
457 aPageMap[0].aDispName = ScGlobal::GetRscString( STR_STYLENAME_STANDARD );
458 aPageMap[0].aProgName = String::CreateFromAscii( SC_STYLE_PROG_STANDARD );
460 aPageMap[1].aDispName = ScGlobal::GetRscString( STR_STYLENAME_REPORT );
461 aPageMap[1].aProgName = String::CreateFromAscii( SC_STYLE_PROG_REPORT );
463 // last entry remains empty
465 bPageMapFilled = TRUE;
467 return aPageMap;
469 DBG_ERROR("invalid family");
470 return NULL;
473 // programmatic name suffix for display names that match other programmatic names
474 // is " (user)" including a space
476 #define SC_SUFFIX_USER " (user)"
477 #define SC_SUFFIX_USER_LEN 7
479 BOOL lcl_EndsWithUser( const String& rString )
481 const sal_Unicode *pChar = rString.GetBuffer();
482 xub_StrLen nLen = rString.Len();
483 return nLen >= SC_SUFFIX_USER_LEN &&
484 pChar[nLen-7] == ' ' &&
485 pChar[nLen-6] == '(' &&
486 pChar[nLen-5] == 'u' &&
487 pChar[nLen-4] == 's' &&
488 pChar[nLen-3] == 'e' &&
489 pChar[nLen-2] == 'r' &&
490 pChar[nLen-1] == ')';
493 // static
494 String ScStyleNameConversion::DisplayToProgrammaticName( const String& rDispName, UINT16 nType )
496 BOOL bDisplayIsProgrammatic = FALSE;
498 const ScDisplayNameMap* pNames = lcl_GetStyleNameMap( nType );
499 if (pNames)
503 if (pNames->aDispName == rDispName)
504 return pNames->aProgName;
505 else if (pNames->aProgName == rDispName)
506 bDisplayIsProgrammatic = TRUE; // display name matches any programmatic name
508 while( (++pNames)->aDispName.Len() );
511 if ( bDisplayIsProgrammatic || lcl_EndsWithUser( rDispName ) )
513 // add the (user) suffix if the display name matches any style's programmatic name
514 // or if it already contains the suffix
516 String aRet(rDispName);
517 aRet.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SC_SUFFIX_USER ) );
518 return aRet;
521 return rDispName;
524 // static
525 String ScStyleNameConversion::ProgrammaticToDisplayName( const String& rProgName, UINT16 nType )
527 if ( lcl_EndsWithUser( rProgName ) )
529 // remove the (user) suffix, don't compare to map entries
530 return rProgName.Copy( 0, rProgName.Len() - SC_SUFFIX_USER_LEN );
533 const ScDisplayNameMap* pNames = lcl_GetStyleNameMap( nType );
534 if (pNames)
538 if (pNames->aProgName == rProgName)
539 return pNames->aDispName;
541 while( (++pNames)->aDispName.Len() );
543 return rProgName;
546 //------------------------------------------------------------------------
548 sal_Bool lcl_AnyTabProtected( ScDocument& rDoc )
550 SCTAB nTabCount = rDoc.GetTableCount();
551 for (SCTAB i=0; i<nTabCount; i++)
552 if (rDoc.IsTabProtected(i))
553 return sal_True;
554 return sal_False;
557 //------------------------------------------------------------------------
559 ScStyleFamiliesObj::ScStyleFamiliesObj(ScDocShell* pDocSh) :
560 pDocShell( pDocSh )
562 pDocShell->GetDocument()->AddUnoObject(*this);
565 ScStyleFamiliesObj::~ScStyleFamiliesObj()
567 if (pDocShell)
568 pDocShell->GetDocument()->RemoveUnoObject(*this);
571 void ScStyleFamiliesObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
573 // Referenz-Update interessiert hier nicht
575 if ( rHint.ISA( SfxSimpleHint ) &&
576 ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
578 pDocShell = NULL; // ungueltig geworden
582 // XStyleFamilies
584 ScStyleFamilyObj*ScStyleFamiliesObj::GetObjectByType_Impl(UINT16 nType) const
586 if ( pDocShell )
588 if ( nType == SFX_STYLE_FAMILY_PARA )
589 return new ScStyleFamilyObj( pDocShell, SFX_STYLE_FAMILY_PARA );
590 else if ( nType == SFX_STYLE_FAMILY_PAGE )
591 return new ScStyleFamilyObj( pDocShell, SFX_STYLE_FAMILY_PAGE );
593 DBG_ERROR("getStyleFamilyByType: keine DocShell oder falscher Typ");
594 return NULL;
597 ScStyleFamilyObj* ScStyleFamiliesObj::GetObjectByIndex_Impl(UINT32 nIndex) const
599 if ( nIndex < SC_STYLE_FAMILY_COUNT )
600 return GetObjectByType_Impl(aStyleFamilyTypes[nIndex]);
602 return NULL; // ungueltiger Index
605 ScStyleFamilyObj* ScStyleFamiliesObj::GetObjectByName_Impl(const rtl::OUString& aName) const
607 if ( pDocShell )
609 String aNameStr( aName );
610 if ( aNameStr.EqualsAscii( SC_FAMILYNAME_CELL ) )
611 return new ScStyleFamilyObj( pDocShell, SFX_STYLE_FAMILY_PARA );
612 else if ( aNameStr.EqualsAscii( SC_FAMILYNAME_PAGE ) )
613 return new ScStyleFamilyObj( pDocShell, SFX_STYLE_FAMILY_PAGE );
615 // no assertion - called directly from getByName
616 return NULL;
619 // container::XIndexAccess
621 sal_Int32 SAL_CALL ScStyleFamiliesObj::getCount() throw(uno::RuntimeException)
623 return SC_STYLE_FAMILY_COUNT;
626 uno::Any SAL_CALL ScStyleFamiliesObj::getByIndex( sal_Int32 nIndex )
627 throw(lang::IndexOutOfBoundsException,
628 lang::WrappedTargetException, uno::RuntimeException)
630 ScUnoGuard aGuard;
631 uno::Reference< container::XNameContainer > xFamily(GetObjectByIndex_Impl(nIndex));
632 if (xFamily.is())
633 return uno::makeAny(xFamily);
634 else
635 throw lang::IndexOutOfBoundsException();
636 // return uno::Any();
639 uno::Type SAL_CALL ScStyleFamiliesObj::getElementType() throw(uno::RuntimeException)
641 ScUnoGuard aGuard;
642 return ::getCppuType((const uno::Reference< container::XNameContainer >*)0); // muss zu getByIndex passen
645 sal_Bool SAL_CALL ScStyleFamiliesObj::hasElements() throw(uno::RuntimeException)
647 ScUnoGuard aGuard;
648 return ( getCount() != 0 );
651 // container::XNameAccess
653 uno::Any SAL_CALL ScStyleFamiliesObj::getByName( const rtl::OUString& aName )
654 throw(container::NoSuchElementException,
655 lang::WrappedTargetException, uno::RuntimeException)
657 ScUnoGuard aGuard;
658 uno::Reference< container::XNameContainer > xFamily(GetObjectByName_Impl(aName));
659 if (xFamily.is())
660 return uno::makeAny(xFamily);
661 else
662 throw container::NoSuchElementException();
663 // return uno::Any();
666 uno::Sequence<rtl::OUString> SAL_CALL ScStyleFamiliesObj::getElementNames()
667 throw(uno::RuntimeException)
669 ScUnoGuard aGuard;
670 uno::Sequence<rtl::OUString> aNames(SC_STYLE_FAMILY_COUNT);
671 rtl::OUString* pNames = aNames.getArray();
672 pNames[0] = rtl::OUString::createFromAscii( SC_FAMILYNAME_CELL );
673 pNames[1] = rtl::OUString::createFromAscii( SC_FAMILYNAME_PAGE );
674 return aNames;
677 sal_Bool SAL_CALL ScStyleFamiliesObj::hasByName( const rtl::OUString& aName )
678 throw(uno::RuntimeException)
680 ScUnoGuard aGuard;
681 String aNameStr( aName );
682 return ( aNameStr.EqualsAscii( SC_FAMILYNAME_CELL ) || aNameStr.EqualsAscii( SC_FAMILYNAME_PAGE ) );
685 // style::XStyleLoader
687 void SAL_CALL ScStyleFamiliesObj::loadStylesFromURL( const rtl::OUString& aURL,
688 const uno::Sequence<beans::PropertyValue>& aOptions )
689 throw(io::IOException, uno::RuntimeException)
691 //! use aOptions (like Writer)
692 //! set flag to disable filter option dialogs when importing
694 String aFilter; // empty - detect
695 String aFiltOpt;
696 ScDocumentLoader aLoader( aURL, aFilter, aFiltOpt );
698 ScDocShell* pSource = aLoader.GetDocShell();
699 if ( pSource && pDocShell )
701 // collect options
703 BOOL bLoadReplace = TRUE; // defaults
704 BOOL bLoadCellStyles = TRUE;
705 BOOL bLoadPageStyles = TRUE;
707 const beans::PropertyValue* pPropArray = aOptions.getConstArray();
708 long nPropCount = aOptions.getLength();
709 for (long i = 0; i < nPropCount; i++)
711 const beans::PropertyValue& rProp = pPropArray[i];
712 String aPropName(rProp.Name);
714 if (aPropName.EqualsAscii( SC_UNONAME_OVERWSTL ))
715 bLoadReplace = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
716 else if (aPropName.EqualsAscii( SC_UNONAME_LOADCELL ))
717 bLoadCellStyles = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
718 else if (aPropName.EqualsAscii( SC_UNONAME_LOADPAGE ))
719 bLoadPageStyles = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
722 pDocShell->LoadStylesArgs( *pSource, bLoadReplace, bLoadCellStyles, bLoadPageStyles );
723 pDocShell->SetDocumentModified(); // paint is inside LoadStyles
727 uno::Sequence<beans::PropertyValue> SAL_CALL ScStyleFamiliesObj::getStyleLoaderOptions()
728 throw(uno::RuntimeException)
730 // return defaults for options (?)
732 uno::Sequence<beans::PropertyValue> aSequence(3);
733 beans::PropertyValue* pArray = aSequence.getArray();
735 pArray[0].Name = rtl::OUString::createFromAscii( SC_UNONAME_OVERWSTL );
736 ScUnoHelpFunctions::SetBoolInAny( pArray[0].Value, TRUE );
738 pArray[1].Name = rtl::OUString::createFromAscii( SC_UNONAME_LOADCELL );
739 ScUnoHelpFunctions::SetBoolInAny( pArray[1].Value, TRUE );
741 pArray[2].Name = rtl::OUString::createFromAscii( SC_UNONAME_LOADPAGE );
742 ScUnoHelpFunctions::SetBoolInAny( pArray[2].Value, TRUE );
744 return aSequence;
747 //------------------------------------------------------------------------
749 ScStyleFamilyObj::ScStyleFamilyObj(ScDocShell* pDocSh, SfxStyleFamily eFam) :
750 pDocShell( pDocSh ),
751 eFamily( eFam )
753 pDocShell->GetDocument()->AddUnoObject(*this);
756 ScStyleFamilyObj::~ScStyleFamilyObj()
758 if (pDocShell)
759 pDocShell->GetDocument()->RemoveUnoObject(*this);
762 void ScStyleFamilyObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
764 // Referenz-Update interessiert hier nicht
766 if ( rHint.ISA( SfxSimpleHint ) &&
767 ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
769 pDocShell = NULL; // ungueltig geworden
773 // XStyleFamily
775 ScStyleObj* ScStyleFamilyObj::GetObjectByIndex_Impl(UINT32 nIndex)
777 if ( pDocShell )
779 ScDocument* pDoc = pDocShell->GetDocument();
780 ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
782 SfxStyleSheetIterator aIter( pStylePool, eFamily );
783 if ( nIndex < aIter.Count() )
785 SfxStyleSheetBase* pStyle = aIter[(USHORT)nIndex];
786 if ( pStyle )
788 return new ScStyleObj( pDocShell, eFamily, String (pStyle->GetName()) );
792 return NULL;
795 ScStyleObj* ScStyleFamilyObj::GetObjectByName_Impl(const rtl::OUString& aName)
797 if ( pDocShell )
799 String aString(aName);
801 ScDocument* pDoc = pDocShell->GetDocument();
802 ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
803 if ( pStylePool->Find( aString, eFamily ) )
804 return new ScStyleObj( pDocShell, eFamily, aString );
806 return NULL;
809 void SAL_CALL ScStyleFamilyObj::insertByName( const rtl::OUString& aName, const uno::Any& aElement )
810 throw(lang::IllegalArgumentException, container::ElementExistException,
811 lang::WrappedTargetException, uno::RuntimeException)
813 ScUnoGuard aGuard;
814 sal_Bool bDone = sal_False;
815 // Reflection muss nicht uno::XInterface sein, kann auch irgendein Interface sein...
816 uno::Reference< uno::XInterface > xInterface(aElement, uno::UNO_QUERY);
817 if ( xInterface.is() )
819 ScStyleObj* pStyleObj = ScStyleObj::getImplementation( xInterface );
820 if ( pStyleObj && pStyleObj->GetFamily() == eFamily &&
821 !pStyleObj->IsInserted() ) // noch nicht eingefuegt?
823 String aNameStr(ScStyleNameConversion::ProgrammaticToDisplayName( aName, sal::static_int_cast<UINT16>(eFamily) ));
825 ScDocument* pDoc = pDocShell->GetDocument();
826 ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
828 //! DocFunc-Funktion??
829 //! Undo ?????????????
831 if ( !pStylePool->Find( aNameStr, eFamily ) ) // noch nicht vorhanden
833 (void)pStylePool->Make( aNameStr, eFamily, SFXSTYLEBIT_USERDEF );
835 pStyleObj->InitDoc( pDocShell, aNameStr ); // Objekt kann benutzt werden
837 pDocShell->SetDocumentModified(); // verwendet wird der neue Style noch nicht
838 bDone = sal_True;
840 else
841 throw container::ElementExistException();
845 if (!bDone)
847 // other errors are handled above
848 throw lang::IllegalArgumentException();
852 void SAL_CALL ScStyleFamilyObj::replaceByName( const rtl::OUString& aName, const uno::Any& aElement )
853 throw(lang::IllegalArgumentException, container::NoSuchElementException,
854 lang::WrappedTargetException, uno::RuntimeException)
856 ScUnoGuard aGuard;
857 //! zusammenfassen?
858 removeByName( aName );
859 insertByName( aName, aElement );
862 void SAL_CALL ScStyleFamilyObj::removeByName( const rtl::OUString& aName )
863 throw(container::NoSuchElementException,
864 lang::WrappedTargetException, uno::RuntimeException)
866 ScUnoGuard aGuard;
867 BOOL bFound = FALSE;
868 if ( pDocShell )
870 String aString(ScStyleNameConversion::ProgrammaticToDisplayName( aName, sal::static_int_cast<UINT16>(eFamily) ));
872 ScDocument* pDoc = pDocShell->GetDocument();
873 ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
875 //! DocFunc-Funktion??
876 //! Undo ?????????????
878 SfxStyleSheetBase* pStyle = pStylePool->Find( aString, eFamily );
879 if (pStyle)
881 bFound = TRUE;
882 if ( eFamily == SFX_STYLE_FAMILY_PARA )
884 // wie ScViewFunc::RemoveStyleSheetInUse
885 VirtualDevice aVDev;
886 Point aLogic = aVDev.LogicToPixel( Point(1000,1000), MAP_TWIP );
887 double nPPTX = aLogic.X() / 1000.0;
888 double nPPTY = aLogic.Y() / 1000.0;
889 Fraction aZoom(1,1);
890 pDoc->StyleSheetChanged( pStyle, sal_False, &aVDev, nPPTX, nPPTY, aZoom, aZoom );
891 pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT );
892 pDocShell->SetDocumentModified();
894 pStylePool->Remove( pStyle );
896 //! InvalidateAttribs(); // Bindings-Invalidate
898 else
900 if ( pDoc->RemovePageStyleInUse( aString ) )
901 pDocShell->PageStyleModified( ScGlobal::GetRscString(STR_STYLENAME_STANDARD), sal_True );
903 pStylePool->Remove( pStyle );
905 SfxBindings* pBindings = pDocShell->GetViewBindings();
906 if (pBindings)
907 pBindings->Invalidate( SID_STYLE_FAMILY4 );
908 pDocShell->SetDocumentModified();
913 if (!bFound)
914 throw container::NoSuchElementException();
917 // container::XIndexAccess
919 sal_Int32 SAL_CALL ScStyleFamilyObj::getCount() throw(uno::RuntimeException)
921 ScUnoGuard aGuard;
922 if ( pDocShell )
924 ScDocument* pDoc = pDocShell->GetDocument();
925 ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
927 SfxStyleSheetIterator aIter( pStylePool, eFamily );
928 return aIter.Count();
930 return 0;
933 uno::Any SAL_CALL ScStyleFamilyObj::getByIndex( sal_Int32 nIndex )
934 throw(lang::IndexOutOfBoundsException,
935 lang::WrappedTargetException, uno::RuntimeException)
937 ScUnoGuard aGuard;
938 uno::Reference< style::XStyle > xObj(GetObjectByIndex_Impl(nIndex));
939 if (xObj.is())
940 return uno::makeAny(xObj);
941 else
942 throw lang::IndexOutOfBoundsException();
943 // return uno::Any();
946 uno::Type SAL_CALL ScStyleFamilyObj::getElementType() throw(uno::RuntimeException)
948 ScUnoGuard aGuard;
949 return ::getCppuType((const uno::Reference< style::XStyle >*)0); // muss zu getByIndex passen
952 sal_Bool SAL_CALL ScStyleFamilyObj::hasElements() throw(uno::RuntimeException)
954 ScUnoGuard aGuard;
955 return ( getCount() != 0 );
958 // container::XNameAccess
960 uno::Any SAL_CALL ScStyleFamilyObj::getByName( const rtl::OUString& aName )
961 throw(container::NoSuchElementException,
962 lang::WrappedTargetException, uno::RuntimeException)
964 ScUnoGuard aGuard;
965 uno::Reference< style::XStyle > xObj(
966 GetObjectByName_Impl( ScStyleNameConversion::ProgrammaticToDisplayName( aName, sal::static_int_cast<UINT16>(eFamily) ) ));
967 if (xObj.is())
968 return uno::makeAny(xObj);
969 else
970 throw container::NoSuchElementException();
971 // return uno::Any();
974 uno::Sequence<rtl::OUString> SAL_CALL ScStyleFamilyObj::getElementNames()
975 throw(uno::RuntimeException)
977 ScUnoGuard aGuard;
978 if ( pDocShell )
980 ScDocument* pDoc = pDocShell->GetDocument();
981 ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
983 SfxStyleSheetIterator aIter( pStylePool, eFamily );
984 UINT16 nCount = aIter.Count();
986 String aName;
987 uno::Sequence<rtl::OUString> aSeq(nCount);
988 rtl::OUString* pAry = aSeq.getArray();
989 SfxStyleSheetBase* pStyle = aIter.First();
990 UINT16 nPos = 0;
991 while (pStyle)
993 DBG_ASSERT( nPos<nCount, "Anzahl durcheinandergekommen" );
994 if (nPos<nCount)
995 pAry[nPos++] = ScStyleNameConversion::DisplayToProgrammaticName(
996 pStyle->GetName(), sal::static_int_cast<UINT16>(eFamily) );
997 pStyle = aIter.Next();
999 return aSeq;
1001 return uno::Sequence<rtl::OUString>();
1004 sal_Bool SAL_CALL ScStyleFamilyObj::hasByName( const rtl::OUString& aName )
1005 throw(uno::RuntimeException)
1007 ScUnoGuard aGuard;
1008 if ( pDocShell )
1010 String aString(ScStyleNameConversion::ProgrammaticToDisplayName( aName, sal::static_int_cast<UINT16>(eFamily) ));
1012 ScDocument* pDoc = pDocShell->GetDocument();
1013 ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
1014 if ( pStylePool->Find( aString, eFamily ) )
1015 return sal_True;
1017 return sal_False;
1020 // XPropertySet
1022 uno::Reference< beans::XPropertySetInfo > SAL_CALL ScStyleFamilyObj::getPropertySetInfo( ) throw (uno::RuntimeException)
1024 OSL_ENSURE( 0, "###unexpected!" );
1025 return uno::Reference< beans::XPropertySetInfo >();
1028 void SAL_CALL ScStyleFamilyObj::setPropertyValue( const ::rtl::OUString&, const uno::Any& ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
1030 OSL_ENSURE( 0, "###unexpected!" );
1033 uno::Any SAL_CALL ScStyleFamilyObj::getPropertyValue( const ::rtl::OUString& sPropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1035 uno::Any aRet;
1037 if ( sPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("DisplayName") ) )
1039 ScUnoGuard aGuard;
1040 sal_uInt32 nResId = 0;
1041 switch ( eFamily )
1043 case SFX_STYLE_FAMILY_PARA:
1044 nResId = STR_STYLE_FAMILY_CELL; break;
1045 case SFX_STYLE_FAMILY_PAGE:
1046 nResId = STR_STYLE_FAMILY_PAGE; break;
1047 default:
1048 OSL_ENSURE( 0, "ScStyleFamilyObj::getPropertyValue(): invalid family" );
1050 if ( nResId > 0 )
1052 ::rtl::OUString sDisplayName( ScGlobal::GetRscString( static_cast< USHORT >( nResId ) ) );
1053 aRet = uno::makeAny( sDisplayName );
1056 else
1058 throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("unknown property: ") ) + sPropertyName, static_cast<OWeakObject *>(this) );
1061 return aRet;
1064 void SAL_CALL ScStyleFamilyObj::addPropertyChangeListener( const ::rtl::OUString&, const uno::Reference< beans::XPropertyChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1066 OSL_ENSURE( 0, "###unexpected!" );
1069 void SAL_CALL ScStyleFamilyObj::removePropertyChangeListener( const ::rtl::OUString&, const uno::Reference< beans::XPropertyChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1071 OSL_ENSURE( 0, "###unexpected!" );
1074 void SAL_CALL ScStyleFamilyObj::addVetoableChangeListener( const ::rtl::OUString&, const uno::Reference< beans::XVetoableChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1076 OSL_ENSURE( 0, "###unexpected!" );
1079 void SAL_CALL ScStyleFamilyObj::removeVetoableChangeListener( const ::rtl::OUString&, const uno::Reference< beans::XVetoableChangeListener >& ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1081 OSL_ENSURE( 0, "###unexpected!" );
1084 //------------------------------------------------------------------------
1086 // Default-ctor wird fuer die Reflection gebraucht
1088 //UNUSED2008-05 ScStyleObj::ScStyleObj() :
1089 //UNUSED2008-05 aPropSet( lcl_GetCellStyleMap() ),
1090 //UNUSED2008-05 pDocShell( NULL ),
1091 //UNUSED2008-05 eFamily( SFX_STYLE_FAMILY_PARA )
1092 //UNUSED2008-05 {
1093 //UNUSED2008-05 }
1095 ScStyleObj::ScStyleObj(ScDocShell* pDocSh, SfxStyleFamily eFam, const String& rName) :
1096 pPropSet( (eFam == SFX_STYLE_FAMILY_PARA) ? lcl_GetCellStyleSet() : lcl_GetPageStyleSet() ),
1097 pDocShell( pDocSh ),
1098 eFamily( eFam ),
1099 aStyleName( rName )
1101 // pDocShell ist Null, wenn per ServiceProvider erzeugt
1103 if (pDocShell)
1104 pDocShell->GetDocument()->AddUnoObject(*this);
1107 void ScStyleObj::InitDoc( ScDocShell* pNewDocSh, const String& rNewName )
1109 if ( pNewDocSh && !pDocShell )
1111 aStyleName = rNewName;
1112 pDocShell = pNewDocSh;
1113 pDocShell->GetDocument()->AddUnoObject(*this);
1117 ScStyleObj::~ScStyleObj()
1119 if (pDocShell)
1120 pDocShell->GetDocument()->RemoveUnoObject(*this);
1123 // XUnoTunnel
1125 sal_Int64 SAL_CALL ScStyleObj::getSomething(
1126 const uno::Sequence<sal_Int8 >& rId ) throw(uno::RuntimeException)
1128 if ( rId.getLength() == 16 &&
1129 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
1130 rId.getConstArray(), 16 ) )
1132 return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
1134 return 0;
1137 // static
1138 const uno::Sequence<sal_Int8>& ScStyleObj::getUnoTunnelId()
1140 static uno::Sequence<sal_Int8> * pSeq = 0;
1141 if( !pSeq )
1143 osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
1144 if( !pSeq )
1146 static uno::Sequence< sal_Int8 > aSeq( 16 );
1147 rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
1148 pSeq = &aSeq;
1151 return *pSeq;
1154 // static
1155 ScStyleObj* ScStyleObj::getImplementation(
1156 const uno::Reference<uno::XInterface> xObj )
1158 ScStyleObj* pRet = NULL;
1159 uno::Reference<lang::XUnoTunnel> xUT( xObj, uno::UNO_QUERY );
1160 if (xUT.is())
1161 pRet = reinterpret_cast<ScStyleObj*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
1162 return pRet;
1165 void ScStyleObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
1167 // Referenz-Update interessiert hier nicht
1169 if ( rHint.ISA( SfxSimpleHint ) &&
1170 ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
1172 pDocShell = NULL; // ungueltig geworden
1176 SfxStyleSheetBase* ScStyleObj::GetStyle_Impl()
1178 if ( pDocShell )
1180 ScDocument* pDoc = pDocShell->GetDocument();
1181 ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
1182 return pStylePool->Find( aStyleName, eFamily );
1184 return NULL;
1187 // style::XStyle
1189 sal_Bool SAL_CALL ScStyleObj::isUserDefined() throw(uno::RuntimeException)
1191 ScUnoGuard aGuard;
1192 SfxStyleSheetBase* pStyle = GetStyle_Impl();
1193 if (pStyle)
1194 return pStyle->IsUserDefined();
1195 return sal_False;
1198 sal_Bool SAL_CALL ScStyleObj::isInUse() throw(uno::RuntimeException)
1200 ScUnoGuard aGuard;
1201 SfxStyleSheetBase* pStyle = GetStyle_Impl();
1202 if (pStyle)
1203 return pStyle->IsUsed();
1204 return sal_False;
1207 rtl::OUString SAL_CALL ScStyleObj::getParentStyle() throw(uno::RuntimeException)
1209 ScUnoGuard aGuard;
1210 SfxStyleSheetBase* pStyle = GetStyle_Impl();
1211 if (pStyle)
1212 return ScStyleNameConversion::DisplayToProgrammaticName( pStyle->GetParent(), sal::static_int_cast<UINT16>(eFamily) );
1213 return rtl::OUString();
1216 void SAL_CALL ScStyleObj::setParentStyle( const rtl::OUString& rParentStyle )
1217 throw(container::NoSuchElementException, uno::RuntimeException)
1219 ScUnoGuard aGuard;
1220 SfxStyleSheetBase* pStyle = GetStyle_Impl();
1221 if (pStyle)
1223 // #70909# cell styles cannot be modified if any sheet is protected
1224 if ( eFamily == SFX_STYLE_FAMILY_PARA && lcl_AnyTabProtected( *pDocShell->GetDocument() ) )
1225 return; //! exception?
1227 //! DocFunc-Funktion??
1228 //! Undo ?????????????
1230 String aString(ScStyleNameConversion::ProgrammaticToDisplayName( rParentStyle, sal::static_int_cast<UINT16>(eFamily) ));
1231 sal_Bool bOk = pStyle->SetParent( aString );
1232 if (bOk)
1234 // wie bei setPropertyValue
1236 ScDocument* pDoc = pDocShell->GetDocument();
1237 if ( eFamily == SFX_STYLE_FAMILY_PARA )
1239 // Zeilenhoehen anpassen...
1241 VirtualDevice aVDev;
1242 Point aLogic = aVDev.LogicToPixel( Point(1000,1000), MAP_TWIP );
1243 double nPPTX = aLogic.X() / 1000.0;
1244 double nPPTY = aLogic.Y() / 1000.0;
1245 Fraction aZoom(1,1);
1246 pDoc->StyleSheetChanged( pStyle, sal_False, &aVDev, nPPTX, nPPTY, aZoom, aZoom );
1248 pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT );
1249 pDocShell->SetDocumentModified();
1251 else
1253 //! ModifyStyleSheet am Dokument (alte Werte merken)
1255 pDocShell->PageStyleModified( aStyleName, sal_True );
1261 // container::XNamed
1263 rtl::OUString SAL_CALL ScStyleObj::getName() throw(uno::RuntimeException)
1265 ScUnoGuard aGuard;
1266 SfxStyleSheetBase* pStyle = GetStyle_Impl();
1267 if (pStyle)
1268 return ScStyleNameConversion::DisplayToProgrammaticName( pStyle->GetName(), sal::static_int_cast<UINT16>(eFamily) );
1269 return rtl::OUString();
1272 void SAL_CALL ScStyleObj::setName( const rtl::OUString& aNewName )
1273 throw(uno::RuntimeException)
1275 ScUnoGuard aGuard;
1276 SfxStyleSheetBase* pStyle = GetStyle_Impl();
1277 if (pStyle)
1279 // #71225# cell styles cannot be renamed if any sheet is protected
1280 if ( eFamily == SFX_STYLE_FAMILY_PARA && lcl_AnyTabProtected( *pDocShell->GetDocument() ) )
1281 return; //! exception?
1283 //! DocFunc-Funktion??
1284 //! Undo ?????????????
1286 String aString(aNewName);
1287 sal_Bool bOk = pStyle->SetName( aString );
1288 if (bOk)
1290 aStyleName = aString; //! notify other objects for this style?
1292 // Zellvorlagen = 2, Seitenvorlagen = 4
1293 UINT16 nId = ( eFamily == SFX_STYLE_FAMILY_PARA ) ?
1294 SID_STYLE_FAMILY2 : SID_STYLE_FAMILY4;
1295 SfxBindings* pBindings = pDocShell->GetViewBindings();
1296 if (pBindings)
1298 pBindings->Invalidate( nId );
1299 pBindings->Invalidate( SID_STYLE_APPLY );
1305 // static
1306 uno::Reference<container::XIndexReplace> ScStyleObj::CreateEmptyNumberingRules()
1308 SvxNumRule aRule( 0, 0, TRUE ); // nothing supported
1309 return SvxCreateNumRule( &aRule );
1312 // beans::XPropertyState
1314 const SfxItemSet* ScStyleObj::GetStyleItemSet_Impl( const ::rtl::OUString& rPropName,
1315 const SfxItemPropertySimpleEntry*& rpResultEntry )
1317 //! OUString as argument?
1319 SfxStyleSheetBase* pStyle = GetStyle_Impl();
1320 if (pStyle)
1322 const SfxItemPropertySimpleEntry* pEntry = NULL;
1323 if ( eFamily == SFX_STYLE_FAMILY_PAGE )
1325 pEntry = lcl_GetHeaderStyleMap()->getByName( rPropName );
1326 if ( pEntry ) // only item-wids in header/footer map
1328 rpResultEntry = pEntry;
1329 return &((const SvxSetItem&)pStyle->GetItemSet().Get(ATTR_PAGE_HEADERSET)).GetItemSet();
1331 pEntry = lcl_GetFooterStyleMap()->getByName( rPropName );
1332 if ( pEntry ) // only item-wids in header/footer map
1334 rpResultEntry = pEntry;
1335 return &((const SvxSetItem&)pStyle->GetItemSet().Get(ATTR_PAGE_FOOTERSET)).GetItemSet();
1338 pEntry = pPropSet->getPropertyMap()->getByName( rPropName );
1339 if ( pEntry )
1341 rpResultEntry = pEntry;
1342 return &pStyle->GetItemSet();
1346 rpResultEntry = NULL;
1347 return NULL;
1350 beans::PropertyState SAL_CALL ScStyleObj::getPropertyState( const rtl::OUString& aPropertyName )
1351 throw(beans::UnknownPropertyException, uno::RuntimeException)
1353 ScUnoGuard aGuard;
1354 beans::PropertyState eRet = beans::PropertyState_DIRECT_VALUE;
1356 const SfxItemPropertySimpleEntry* pResultEntry = NULL;
1357 const SfxItemSet* pItemSet = GetStyleItemSet_Impl( aPropertyName, pResultEntry );
1359 if ( pItemSet && pResultEntry )
1361 USHORT nWhich = pResultEntry->nWID;
1362 if ( nWhich == SC_WID_UNO_TBLBORD )
1364 nWhich = ATTR_BORDER;
1366 if ( IsScItemWid( nWhich ) )
1368 SfxItemState eState = pItemSet->GetItemState( nWhich, sal_False );
1370 // // if no rotate value is set, look at orientation
1371 // //! also for a fixed value of 0 (in case orientation is ambiguous)?
1372 // if ( nWhich == ATTR_ROTATE_VALUE && eState == SFX_ITEM_DEFAULT )
1373 // eState = pItemSet->GetItemState( ATTR_ORIENTATION, sal_False );
1375 if ( eState == SFX_ITEM_SET )
1376 eRet = beans::PropertyState_DIRECT_VALUE;
1377 else if ( eState == SFX_ITEM_DEFAULT )
1378 eRet = beans::PropertyState_DEFAULT_VALUE;
1379 else if ( eState == SFX_ITEM_DONTCARE )
1380 eRet = beans::PropertyState_AMBIGUOUS_VALUE; // kann eigentlich nicht sein...
1381 else
1383 DBG_ERROR("unbekannter ItemState");
1387 return eRet;
1390 uno::Sequence<beans::PropertyState> SAL_CALL ScStyleObj::getPropertyStates(
1391 const uno::Sequence<rtl::OUString>& aPropertyNames )
1392 throw(beans::UnknownPropertyException, uno::RuntimeException)
1394 // duemmliche Default-Implementierung: alles einzeln per getPropertyState holen
1395 //! sollte optimiert werden!
1397 ScUnoGuard aGuard;
1398 const rtl::OUString* pNames = aPropertyNames.getConstArray();
1399 uno::Sequence<beans::PropertyState> aRet(aPropertyNames.getLength());
1400 beans::PropertyState* pStates = aRet.getArray();
1401 for(sal_Int32 i = 0; i < aPropertyNames.getLength(); i++)
1402 pStates[i] = getPropertyState(pNames[i]);
1403 return aRet;
1406 void SAL_CALL ScStyleObj::setPropertyToDefault( const rtl::OUString& aPropertyName )
1407 throw(beans::UnknownPropertyException, uno::RuntimeException)
1409 ScUnoGuard aGuard;
1411 const SfxItemPropertyMap* pMap = pPropSet->getPropertyMap();
1412 const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( aPropertyName );
1413 if ( !pEntry )
1414 throw beans::UnknownPropertyException();
1416 SetOnePropertyValue( aPropertyName, pEntry, NULL );
1419 uno::Any SAL_CALL ScStyleObj::getPropertyDefault( const rtl::OUString& aPropertyName )
1420 throw(beans::UnknownPropertyException, lang::WrappedTargetException,
1421 uno::RuntimeException)
1423 ScUnoGuard aGuard;
1424 uno::Any aAny;
1426 const SfxItemPropertySimpleEntry* pResultEntry = NULL;
1427 const SfxItemSet* pStyleSet = GetStyleItemSet_Impl( aPropertyName, pResultEntry );
1429 if ( pStyleSet && pResultEntry )
1431 USHORT nWhich = pResultEntry->nWID;
1433 if ( IsScItemWid( nWhich ) )
1435 // Default ist Default vom ItemPool, nicht vom Standard-Style,
1436 // damit es zu setPropertyToDefault passt
1437 SfxItemSet aEmptySet( *pStyleSet->GetPool(), pStyleSet->GetRanges() );
1438 // #65253# Default-Items mit falscher Slot-ID funktionieren im SfxItemPropertySet3 nicht
1439 //! Slot-IDs aendern...
1440 if ( aEmptySet.GetPool()->GetSlotId(nWhich) == nWhich &&
1441 aEmptySet.GetItemState(nWhich, sal_False) == SFX_ITEM_DEFAULT )
1443 aEmptySet.Put( aEmptySet.Get( nWhich ) );
1445 const SfxItemSet* pItemSet = &aEmptySet;
1447 switch ( nWhich ) // fuer Item-Spezial-Behandlungen
1449 case ATTR_VALUE_FORMAT:
1450 // default has no language set
1451 aAny <<= sal_Int32( ((const SfxUInt32Item&)pItemSet->Get(nWhich)).GetValue() );
1452 break;
1453 case ATTR_INDENT:
1454 aAny <<= sal_Int16( TwipsToHMM(((const SfxUInt16Item&)
1455 pItemSet->Get(nWhich)).GetValue()) );
1456 break;
1457 case ATTR_PAGE_SCALE:
1458 case ATTR_PAGE_SCALETOPAGES:
1459 case ATTR_PAGE_FIRSTPAGENO:
1460 aAny <<= sal_Int16( ((const SfxUInt16Item&)pItemSet->Get(nWhich)).GetValue() );
1461 break;
1462 case ATTR_PAGE_CHARTS:
1463 case ATTR_PAGE_OBJECTS:
1464 case ATTR_PAGE_DRAWINGS:
1465 //! sal_Bool-MID fuer ScViewObjectModeItem definieren?
1466 aAny <<= sal_Bool( ((const ScViewObjectModeItem&)pItemSet->Get(nWhich)).
1467 GetValue() == VOBJ_MODE_SHOW );
1468 break;
1469 case ATTR_PAGE_SCALETO:
1471 const ScPageScaleToItem aItem((const ScPageScaleToItem&)pItemSet->Get(nWhich));
1472 if (aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SC_UNO_PAGE_SCALETOX )))
1473 aAny = uno::makeAny(static_cast<sal_Int16>(aItem.GetWidth()));
1474 else
1475 aAny = uno::makeAny(static_cast<sal_Int16>(aItem.GetHeight()));
1477 break;
1478 default:
1479 pPropSet->getPropertyValue( *pResultEntry, *pItemSet, aAny );
1482 else if ( IsScUnoWid( nWhich ) )
1484 SfxItemSet aEmptySet( *pStyleSet->GetPool(), pStyleSet->GetRanges() );
1485 const SfxItemSet* pItemSet = &aEmptySet;
1486 switch ( nWhich )
1488 case SC_WID_UNO_TBLBORD:
1490 const SfxPoolItem* pItem = &pItemSet->Get( ATTR_BORDER );
1491 if ( pItem )
1493 SvxBoxItem aOuter( *( static_cast<const SvxBoxItem*>( pItem ) ) );
1494 SvxBoxInfoItem aInner( ATTR_BORDER_INNER );
1495 table::TableBorder aBorder;
1496 ScHelperFunctions::FillTableBorder( aBorder, aOuter, aInner );
1497 aBorder.IsHorizontalLineValid = sal_False;
1498 aBorder.IsVerticalLineValid = sal_False;
1499 aBorder.IsDistanceValid = sal_False;
1500 aAny <<= aBorder;
1503 break;
1507 return aAny;
1510 // XMultiPropertySet
1512 void SAL_CALL ScStyleObj::setPropertyValues( const uno::Sequence< rtl::OUString >& aPropertyNames,
1513 const uno::Sequence< uno::Any >& aValues )
1514 throw (beans::PropertyVetoException, lang::IllegalArgumentException,
1515 lang::WrappedTargetException, uno::RuntimeException)
1517 ScUnoGuard aGuard;
1519 sal_Int32 nCount = aPropertyNames.getLength();
1520 if ( aValues.getLength() != nCount )
1521 throw lang::IllegalArgumentException();
1523 if ( nCount )
1525 const rtl::OUString* pNames = aPropertyNames.getConstArray();
1526 const uno::Any* pValues = aValues.getConstArray();
1528 const SfxItemPropertyMap* pPropertyMap = pPropSet->getPropertyMap();
1529 for (sal_Int32 i = 0; i < nCount; i++)
1531 const SfxItemPropertySimpleEntry* pEntry = pPropertyMap->getByName( pNames[i] );
1532 SetOnePropertyValue( pNames[i], pEntry, &pValues[i] );
1537 uno::Sequence<uno::Any> SAL_CALL ScStyleObj::getPropertyValues(
1538 const uno::Sequence< rtl::OUString >& aPropertyNames )
1539 throw (uno::RuntimeException)
1541 ScUnoGuard aGuard;
1543 //! optimize
1545 sal_Int32 nCount = aPropertyNames.getLength();
1546 uno::Sequence<uno::Any> aSequence( nCount );
1547 if ( nCount )
1549 uno::Any* pValues = aSequence.getArray();
1550 for (sal_Int32 i=0; i<nCount; i++)
1551 pValues[i] = getPropertyValue( aPropertyNames[i] );
1553 return aSequence;
1556 void SAL_CALL ScStyleObj::addPropertiesChangeListener( const uno::Sequence<rtl::OUString>& /* aPropertyNames */,
1557 const uno::Reference<beans::XPropertiesChangeListener>& /* xListener */ )
1558 throw (uno::RuntimeException)
1560 // no bound properties
1563 void SAL_CALL ScStyleObj::removePropertiesChangeListener(
1564 const uno::Reference<beans::XPropertiesChangeListener>& /* xListener */ )
1565 throw (uno::RuntimeException)
1567 // no bound properties
1570 void SAL_CALL ScStyleObj::firePropertiesChangeEvent( const uno::Sequence<rtl::OUString>& /* aPropertyNames */,
1571 const uno::Reference<beans::XPropertiesChangeListener>& /* xListener */ )
1572 throw (uno::RuntimeException)
1574 // no bound properties
1577 // XMultiPropertyStates
1578 // getPropertyStates already defined for XPropertyState
1580 void SAL_CALL ScStyleObj::setAllPropertiesToDefault() throw (uno::RuntimeException)
1582 ScUnoGuard aGuard;
1584 SfxStyleSheetBase* pStyle = GetStyle_Impl();
1585 if ( pStyle )
1587 // #70909# cell styles cannot be modified if any sheet is protected
1588 if ( eFamily == SFX_STYLE_FAMILY_PARA && lcl_AnyTabProtected( *pDocShell->GetDocument() ) )
1589 throw uno::RuntimeException();
1591 SfxItemSet& rSet = pStyle->GetItemSet();
1592 rSet.ClearItem(); // set all items to default
1594 //! merge with SetOneProperty
1596 ScDocument* pDoc = pDocShell->GetDocument();
1597 if ( eFamily == SFX_STYLE_FAMILY_PARA )
1599 // row heights
1601 VirtualDevice aVDev;
1602 Point aLogic = aVDev.LogicToPixel( Point(1000,1000), MAP_TWIP );
1603 double nPPTX = aLogic.X() / 1000.0;
1604 double nPPTY = aLogic.Y() / 1000.0;
1605 Fraction aZoom(1,1);
1606 pDoc->StyleSheetChanged( pStyle, sal_False, &aVDev, nPPTX, nPPTY, aZoom, aZoom );
1608 pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT );
1609 pDocShell->SetDocumentModified();
1611 else
1613 // #i22448# apply the default BoxInfoItem for page styles again
1614 // (same content as in ScStyleSheet::GetItemSet, to control the dialog)
1615 SvxBoxInfoItem aBoxInfoItem( ATTR_BORDER_INNER );
1616 aBoxInfoItem.SetTable( FALSE );
1617 aBoxInfoItem.SetDist( TRUE );
1618 aBoxInfoItem.SetValid( VALID_DISTANCE, TRUE );
1619 rSet.Put( aBoxInfoItem );
1621 pDocShell->PageStyleModified( aStyleName, sal_True );
1626 void SAL_CALL ScStyleObj::setPropertiesToDefault( const uno::Sequence<rtl::OUString>& aPropertyNames )
1627 throw (beans::UnknownPropertyException, uno::RuntimeException)
1629 ScUnoGuard aGuard;
1631 sal_Int32 nCount = aPropertyNames.getLength();
1632 if ( nCount )
1634 const rtl::OUString* pNames = aPropertyNames.getConstArray();
1636 const SfxItemPropertyMap* pPropertyMap = pPropSet->getPropertyMap();
1637 for (sal_Int32 i = 0; i < nCount; i++)
1639 const SfxItemPropertySimpleEntry* pEntry = pPropertyMap->getByName( pNames[i] );
1640 SetOnePropertyValue( pNames[i], pEntry, NULL );
1645 uno::Sequence<uno::Any> SAL_CALL ScStyleObj::getPropertyDefaults(
1646 const uno::Sequence<rtl::OUString>& aPropertyNames )
1647 throw (beans::UnknownPropertyException, lang::WrappedTargetException,
1648 uno::RuntimeException)
1650 ScUnoGuard aGuard;
1652 //! optimize
1654 sal_Int32 nCount = aPropertyNames.getLength();
1655 uno::Sequence<uno::Any> aSequence( nCount );
1656 if ( nCount )
1658 uno::Any* pValues = aSequence.getArray();
1659 for (sal_Int32 i=0; i<nCount; i++)
1660 pValues[i] = getPropertyDefault( aPropertyNames[i] );
1662 return aSequence;
1665 // beans::XPropertySet
1667 uno::Reference<beans::XPropertySetInfo> SAL_CALL ScStyleObj::getPropertySetInfo()
1668 throw(uno::RuntimeException)
1670 ScUnoGuard aGuard;
1671 return pPropSet->getPropertySetInfo();
1674 void SAL_CALL ScStyleObj::setPropertyValue(
1675 const rtl::OUString& aPropertyName, const uno::Any& aValue )
1676 throw(beans::UnknownPropertyException, beans::PropertyVetoException,
1677 lang::IllegalArgumentException, lang::WrappedTargetException,
1678 uno::RuntimeException)
1680 ScUnoGuard aGuard;
1682 const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMap()->getByName( aPropertyName );
1683 if ( !pEntry )
1684 throw beans::UnknownPropertyException();
1686 SetOnePropertyValue( aPropertyName, pEntry, &aValue );
1689 void ScStyleObj::SetOnePropertyValue( const ::rtl::OUString& rPropertyName, const SfxItemPropertySimpleEntry* pEntry, const uno::Any* pValue )
1690 throw(lang::IllegalArgumentException, uno::RuntimeException)
1692 SfxStyleSheetBase* pStyle = GetStyle_Impl();
1693 if ( pStyle && pEntry )
1695 // #70909# cell styles cannot be modified if any sheet is protected
1696 if ( eFamily == SFX_STYLE_FAMILY_PARA && lcl_AnyTabProtected( *pDocShell->GetDocument() ) )
1697 throw uno::RuntimeException();
1699 SfxItemSet& rSet = pStyle->GetItemSet(); // direkt im lebenden Style aendern...
1700 sal_Bool bDone = sal_False;
1701 if ( eFamily == SFX_STYLE_FAMILY_PAGE )
1703 if(pEntry->nWID == SC_WID_UNO_HEADERSET)
1705 const SfxItemPropertySimpleEntry* pHeaderEntry = lcl_GetHeaderStyleMap()->getByName( rPropertyName );
1706 if ( pHeaderEntry ) // only item-wids in header/footer map
1708 SvxSetItem aNewHeader( (const SvxSetItem&)rSet.Get(ATTR_PAGE_HEADERSET) );
1709 if (pValue)
1710 pPropSet->setPropertyValue( *pHeaderEntry, *pValue, aNewHeader.GetItemSet() );
1711 else
1712 aNewHeader.GetItemSet().ClearItem( pHeaderEntry->nWID );
1713 rSet.Put( aNewHeader );
1714 bDone = sal_True;
1717 else if(pEntry->nWID == SC_WID_UNO_FOOTERSET)
1719 const SfxItemPropertySimpleEntry* pFooterEntry = lcl_GetFooterStyleMap()->getByName( rPropertyName );
1720 if ( pFooterEntry ) // only item-wids in header/footer map
1722 SvxSetItem aNewFooter( (const SvxSetItem&)rSet.Get(ATTR_PAGE_FOOTERSET) );
1723 if (pValue)
1724 pPropSet->setPropertyValue( *pFooterEntry, *pValue, aNewFooter.GetItemSet() );
1725 else
1726 aNewFooter.GetItemSet().ClearItem( pFooterEntry->nWID );
1727 rSet.Put( aNewFooter );
1728 bDone = sal_True;
1732 if (!bDone)
1734 if ( pEntry )
1736 if ( IsScItemWid( pEntry->nWID ) )
1738 if (pValue)
1740 switch ( pEntry->nWID ) // fuer Item-Spezial-Behandlungen
1742 case ATTR_VALUE_FORMAT:
1744 // #67847# language for number formats
1745 SvNumberFormatter* pFormatter =
1746 pDocShell->GetDocument()->GetFormatTable();
1747 UINT32 nOldFormat = ((const SfxUInt32Item&)
1748 rSet.Get( ATTR_VALUE_FORMAT )).GetValue();
1749 LanguageType eOldLang = ((const SvxLanguageItem&)
1750 rSet.Get( ATTR_LANGUAGE_FORMAT )).GetLanguage();
1751 nOldFormat = pFormatter->
1752 GetFormatForLanguageIfBuiltIn( nOldFormat, eOldLang );
1754 UINT32 nNewFormat = 0;
1755 *pValue >>= nNewFormat;
1756 rSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNewFormat ) );
1758 const SvNumberformat* pNewEntry = pFormatter->GetEntry( nNewFormat );
1759 LanguageType eNewLang =
1760 pNewEntry ? pNewEntry->GetLanguage() : LANGUAGE_DONTKNOW;
1761 if ( eNewLang != eOldLang && eNewLang != LANGUAGE_DONTKNOW )
1762 rSet.Put( SvxLanguageItem( eNewLang, ATTR_LANGUAGE_FORMAT ) );
1764 //! keep default state of number format if only language changed?
1766 break;
1767 case ATTR_INDENT:
1769 sal_Int16 nVal = 0;
1770 *pValue >>= nVal;
1771 rSet.Put( SfxUInt16Item( pEntry->nWID, (USHORT)HMMToTwips(nVal) ) );
1773 break;
1774 case ATTR_ROTATE_VALUE:
1776 sal_Int32 nRotVal = 0;
1777 if ( *pValue >>= nRotVal )
1779 // stored value is always between 0 and 360 deg.
1780 nRotVal %= 36000;
1781 if ( nRotVal < 0 )
1782 nRotVal += 36000;
1783 rSet.Put( SfxInt32Item( ATTR_ROTATE_VALUE, nRotVal ) );
1786 break;
1787 case ATTR_STACKED:
1789 table::CellOrientation eOrient;
1790 if( *pValue >>= eOrient )
1792 switch( eOrient )
1794 case table::CellOrientation_STANDARD:
1795 rSet.Put( SfxBoolItem( ATTR_STACKED, FALSE ) );
1796 break;
1797 case table::CellOrientation_TOPBOTTOM:
1798 rSet.Put( SfxBoolItem( ATTR_STACKED, FALSE ) );
1799 rSet.Put( SfxInt32Item( ATTR_ROTATE_VALUE, 27000 ) );
1800 break;
1801 case table::CellOrientation_BOTTOMTOP:
1802 rSet.Put( SfxBoolItem( ATTR_STACKED, FALSE ) );
1803 rSet.Put( SfxInt32Item( ATTR_ROTATE_VALUE, 9000 ) );
1804 break;
1805 case table::CellOrientation_STACKED:
1806 rSet.Put( SfxBoolItem( ATTR_STACKED, TRUE ) );
1807 break;
1808 default:
1810 // added to avoid warnings
1815 break;
1816 case ATTR_PAGE_SCALE:
1817 case ATTR_PAGE_SCALETOPAGES:
1819 rSet.ClearItem(ATTR_PAGE_SCALETOPAGES);
1820 rSet.ClearItem(ATTR_PAGE_SCALE);
1821 rSet.ClearItem(ATTR_PAGE_SCALETO);
1822 sal_Int16 nVal = 0;
1823 *pValue >>= nVal;
1824 rSet.Put( SfxUInt16Item( pEntry->nWID, nVal ) );
1826 break;
1827 case ATTR_PAGE_FIRSTPAGENO:
1829 sal_Int16 nVal = 0;
1830 *pValue >>= nVal;
1831 rSet.Put( SfxUInt16Item( ATTR_PAGE_FIRSTPAGENO, nVal ) );
1833 break;
1834 case ATTR_PAGE_CHARTS:
1835 case ATTR_PAGE_OBJECTS:
1836 case ATTR_PAGE_DRAWINGS:
1838 sal_Bool bBool = sal_False;
1839 *pValue >>= bBool;
1840 //! sal_Bool-MID fuer ScViewObjectModeItem definieren?
1841 rSet.Put( ScViewObjectModeItem( pEntry->nWID,
1842 bBool ? VOBJ_MODE_SHOW : VOBJ_MODE_HIDE ) );
1844 break;
1845 case ATTR_PAGE_PAPERBIN:
1847 BYTE nTray = PAPERBIN_PRINTER_SETTINGS;
1848 BOOL bFound = FALSE;
1850 rtl::OUString aName;
1851 if ( *pValue >>= aName )
1853 if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( SC_PAPERBIN_DEFAULTNAME ) ) )
1854 bFound = TRUE;
1855 else
1857 Printer* pPrinter = pDocShell->GetPrinter();
1858 if (pPrinter)
1860 String aNameStr = aName;
1861 USHORT nCount = pPrinter->GetPaperBinCount();
1862 for (USHORT i=0; i<nCount; i++)
1863 if ( aNameStr == pPrinter->GetPaperBinName(i) )
1865 nTray = (BYTE) i;
1866 bFound = TRUE;
1867 break;
1872 if ( bFound )
1873 rSet.Put( SvxPaperBinItem( ATTR_PAGE_PAPERBIN, nTray ) );
1874 else
1875 throw lang::IllegalArgumentException();
1877 break;
1878 case ATTR_PAGE_SCALETO:
1880 sal_Int16 nPages = 0;
1881 if (*pValue >>= nPages)
1883 ScPageScaleToItem aItem = ((const ScPageScaleToItem&)rSet.Get(ATTR_PAGE_SCALETO));
1884 if ( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SC_UNO_PAGE_SCALETOX)))
1885 aItem.SetWidth(static_cast<sal_uInt16>(nPages));
1886 else
1887 aItem.SetHeight(static_cast<sal_uInt16>(nPages));
1888 rSet.Put( aItem );
1889 rSet.ClearItem(ATTR_PAGE_SCALETOPAGES);
1890 rSet.ClearItem(ATTR_PAGE_SCALE);
1893 break;
1894 default:
1895 // #65253# Default-Items mit falscher Slot-ID
1896 // funktionieren im SfxItemPropertySet3 nicht
1897 //! Slot-IDs aendern...
1898 if ( rSet.GetPool()->GetSlotId(pEntry->nWID) == pEntry->nWID &&
1899 rSet.GetItemState(pEntry->nWID, sal_False) == SFX_ITEM_DEFAULT )
1901 rSet.Put( rSet.Get(pEntry->nWID) );
1903 pPropSet->setPropertyValue( *pEntry, *pValue, rSet );
1906 else
1908 rSet.ClearItem( pEntry->nWID );
1909 // #67847# language for number formats
1910 if ( pEntry->nWID == ATTR_VALUE_FORMAT )
1911 rSet.ClearItem( ATTR_LANGUAGE_FORMAT );
1913 //! for ATTR_ROTATE_VALUE, also reset ATTR_ORIENTATION?
1916 else if ( IsScUnoWid( pEntry->nWID ) )
1918 switch ( pEntry->nWID )
1920 case SC_WID_UNO_TBLBORD:
1922 if (pValue)
1924 table::TableBorder aBorder;
1925 if ( *pValue >>= aBorder )
1927 SvxBoxItem aOuter( ATTR_BORDER );
1928 SvxBoxInfoItem aInner( ATTR_BORDER_INNER );
1929 ScHelperFunctions::FillBoxItems( aOuter, aInner, aBorder );
1930 rSet.Put( aOuter );
1933 else
1935 rSet.ClearItem( ATTR_BORDER );
1938 break;
1944 //! DocFunc-Funktion??
1945 //! Undo ?????????????
1947 ScDocument* pDoc = pDocShell->GetDocument();
1948 if ( eFamily == SFX_STYLE_FAMILY_PARA )
1950 // Zeilenhoehen anpassen...
1952 VirtualDevice aVDev;
1953 Point aLogic = aVDev.LogicToPixel( Point(1000,1000), MAP_TWIP );
1954 double nPPTX = aLogic.X() / 1000.0;
1955 double nPPTY = aLogic.Y() / 1000.0;
1956 Fraction aZoom(1,1);
1957 pDoc->StyleSheetChanged( pStyle, sal_False, &aVDev, nPPTX, nPPTY, aZoom, aZoom );
1959 pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PAINT_GRID|PAINT_LEFT );
1960 pDocShell->SetDocumentModified();
1962 else
1964 //! ModifyStyleSheet am Dokument (alte Werte merken)
1966 pDocShell->PageStyleModified( aStyleName, sal_True );
1971 uno::Any SAL_CALL ScStyleObj::getPropertyValue( const rtl::OUString& aPropertyName )
1972 throw(beans::UnknownPropertyException, lang::WrappedTargetException,
1973 uno::RuntimeException)
1975 ScUnoGuard aGuard;
1976 uno::Any aAny;
1978 if ( aPropertyName.equalsAscii( SC_UNONAME_DISPNAME ) ) // read-only
1980 // core always has the display name
1981 SfxStyleSheetBase* pStyle = GetStyle_Impl();
1982 if (pStyle)
1983 aAny <<= rtl::OUString( pStyle->GetName() );
1985 else
1987 const SfxItemPropertySimpleEntry* pResultEntry = NULL;
1988 const SfxItemSet* pItemSet = GetStyleItemSet_Impl( aPropertyName, pResultEntry );
1990 if ( pItemSet && pResultEntry )
1992 USHORT nWhich = pResultEntry->nWID;
1994 if ( IsScItemWid( nWhich ) )
1996 switch ( nWhich ) // fuer Item-Spezial-Behandlungen
1998 case ATTR_VALUE_FORMAT:
1999 if ( pDocShell )
2001 UINT32 nOldFormat = ((const SfxUInt32Item&)
2002 pItemSet->Get( ATTR_VALUE_FORMAT )).GetValue();
2003 LanguageType eOldLang = ((const SvxLanguageItem&)
2004 pItemSet->Get( ATTR_LANGUAGE_FORMAT )).GetLanguage();
2005 nOldFormat = pDocShell->GetDocument()->GetFormatTable()->
2006 GetFormatForLanguageIfBuiltIn( nOldFormat, eOldLang );
2007 aAny <<= nOldFormat;
2009 break;
2010 case ATTR_INDENT:
2011 aAny <<= sal_Int16( TwipsToHMM(((const SfxUInt16Item&)
2012 pItemSet->Get(nWhich)).GetValue()) );
2013 break;
2014 case ATTR_STACKED:
2016 sal_Int32 nRot = ((const SfxInt32Item&)pItemSet->Get(ATTR_ROTATE_VALUE)).GetValue();
2017 BOOL bStacked = ((const SfxBoolItem&)pItemSet->Get(nWhich)).GetValue();
2018 SvxOrientationItem( nRot, bStacked, 0 ).QueryValue( aAny );
2020 break;
2021 case ATTR_PAGE_SCALE:
2022 case ATTR_PAGE_SCALETOPAGES:
2023 case ATTR_PAGE_FIRSTPAGENO:
2024 aAny <<= sal_Int16( ((const SfxUInt16Item&)pItemSet->Get(nWhich)).GetValue() );
2025 break;
2026 case ATTR_PAGE_CHARTS:
2027 case ATTR_PAGE_OBJECTS:
2028 case ATTR_PAGE_DRAWINGS:
2029 //! sal_Bool-MID fuer ScViewObjectModeItem definieren?
2030 aAny <<= sal_Bool( ((const ScViewObjectModeItem&)pItemSet->
2031 Get(nWhich)).GetValue() == VOBJ_MODE_SHOW );
2032 break;
2033 case ATTR_PAGE_PAPERBIN:
2035 // property PrinterPaperTray is the name of the tray
2037 BYTE nValue = ((const SvxPaperBinItem&)pItemSet->Get(nWhich)).GetValue();
2038 rtl::OUString aName;
2039 if ( nValue == PAPERBIN_PRINTER_SETTINGS )
2040 aName = rtl::OUString::createFromAscii( SC_PAPERBIN_DEFAULTNAME );
2041 else
2043 Printer* pPrinter = pDocShell->GetPrinter();
2044 if (pPrinter)
2045 aName = pPrinter->GetPaperBinName( nValue );
2047 aAny <<= aName;
2049 break;
2050 case ATTR_PAGE_SCALETO:
2052 ScPageScaleToItem aItem((const ScPageScaleToItem&)pItemSet->Get(ATTR_PAGE_SCALETO));
2053 if (aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SC_UNO_PAGE_SCALETOX)))
2054 aAny = uno::makeAny(static_cast<sal_Int16>(aItem.GetWidth()));
2055 else
2056 aAny = uno::makeAny(static_cast<sal_Int16>(aItem.GetHeight()));
2058 break;
2059 default:
2060 // #65253# Default-Items mit falscher Slot-ID
2061 // funktionieren im SfxItemPropertySet3 nicht
2062 //! Slot-IDs aendern...
2063 if ( pItemSet->GetPool()->GetSlotId(nWhich) == nWhich &&
2064 pItemSet->GetItemState(nWhich, sal_False) == SFX_ITEM_DEFAULT )
2066 SfxItemSet aNoEmptySet( *pItemSet );
2067 aNoEmptySet.Put( aNoEmptySet.Get( nWhich ) );
2068 pPropSet->getPropertyValue( *pResultEntry, aNoEmptySet, aAny );
2070 else
2071 pPropSet->getPropertyValue( *pResultEntry, *pItemSet, aAny );
2074 else if ( IsScUnoWid( nWhich ) )
2076 switch ( nWhich )
2078 case SC_WID_UNO_TBLBORD:
2080 const SfxPoolItem* pItem = &pItemSet->Get( ATTR_BORDER );
2081 if ( pItem )
2083 SvxBoxItem aOuter( *( static_cast<const SvxBoxItem*>( pItem ) ) );
2084 SvxBoxInfoItem aInner( ATTR_BORDER_INNER );
2085 table::TableBorder aBorder;
2086 ScHelperFunctions::FillTableBorder( aBorder, aOuter, aInner );
2087 aBorder.IsHorizontalLineValid = sal_False;
2088 aBorder.IsVerticalLineValid = sal_False;
2089 aBorder.IsDistanceValid = sal_False;
2090 aAny <<= aBorder;
2093 break;
2099 return aAny;
2102 SC_IMPL_DUMMY_PROPERTY_LISTENER( ScStyleObj )
2104 // lang::XServiceInfo
2106 rtl::OUString SAL_CALL ScStyleObj::getImplementationName() throw(uno::RuntimeException)
2108 return rtl::OUString::createFromAscii( "ScStyleObj" );
2111 sal_Bool SAL_CALL ScStyleObj::supportsService( const rtl::OUString& rServiceName )
2112 throw(uno::RuntimeException)
2114 BOOL bPage = ( eFamily == SFX_STYLE_FAMILY_PAGE );
2115 return rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SCSTYLE_SERVICE ) )||
2116 rServiceName.equalsAsciiL(
2117 RTL_CONSTASCII_STRINGPARAM ( bPage ? SCPAGESTYLE_SERVICE : SCCELLSTYLE_SERVICE ));
2120 uno::Sequence<rtl::OUString> SAL_CALL ScStyleObj::getSupportedServiceNames()
2121 throw(uno::RuntimeException)
2123 BOOL bPage = ( eFamily == SFX_STYLE_FAMILY_PAGE );
2124 uno::Sequence<rtl::OUString> aRet(2);
2125 rtl::OUString* pArray = aRet.getArray();
2126 pArray[0] = rtl::OUString::createFromAscii( SCSTYLE_SERVICE );
2127 pArray[1] = rtl::OUString::createFromAscii( bPage ? SCPAGESTYLE_SERVICE
2128 : SCCELLSTYLE_SERVICE );
2129 return aRet;
2132 //------------------------------------------------------------------------