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