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