tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / unoobj / styleuno.cxx
blob659a271a05e03080da029e874be71850a26b8e8b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <scitems.hxx>
21 #include <editeng/memberids.h>
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 <svx/unoshape.hxx>
30 #include <svx/unoshprp.hxx>
31 #include <svx/xflbstit.hxx>
32 #include <svx/xflbmtit.hxx>
33 #include <editeng/unonrule.hxx>
34 #include <sfx2/bindings.hxx>
35 #include <sfx2/printer.hxx>
36 #include <sfx2/sfxsids.hrc>
37 #include <utility>
38 #include <vcl/virdev.hxx>
39 #include <vcl/svapp.hxx>
40 #include <svl/itempool.hxx>
41 #include <svl/itemset.hxx>
42 #include <svl/numformat.hxx>
43 #include <svl/intitem.hxx>
44 #include <svl/zformat.hxx>
45 #include <tools/fract.hxx>
46 #include <tools/UnitConversion.hxx>
47 #include <osl/diagnose.h>
49 #include <com/sun/star/drawing/BitmapMode.hpp>
50 #include <com/sun/star/table/BorderLine.hpp>
51 #include <com/sun/star/table/TableBorder.hpp>
52 #include <com/sun/star/table/TableBorder2.hpp>
53 #include <com/sun/star/table/ShadowFormat.hpp>
54 #include <com/sun/star/table/CellHoriJustify.hpp>
55 #include <com/sun/star/table/CellOrientation.hpp>
56 #include <com/sun/star/style/PageStyleLayout.hpp>
57 #include <com/sun/star/style/GraphicLocation.hpp>
58 #include <com/sun/star/sheet/XHeaderFooterContent.hpp>
59 #include <com/sun/star/util/CellProtection.hpp>
60 #include <com/sun/star/awt/FontSlant.hpp>
61 #include <com/sun/star/awt/Size.hpp>
62 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
63 #include <com/sun/star/lang/Locale.hpp>
64 #include <com/sun/star/beans/PropertyAttribute.hpp>
65 #include <com/sun/star/graphic/XGraphic.hpp>
66 #include <comphelper/propertysequence.hxx>
67 #include <cppuhelper/supportsservice.hxx>
69 #include <CommonProperties.hxx>
70 #include <styleuno.hxx>
71 #include <docsh.hxx>
72 #include <attrib.hxx>
73 #include <stlpool.hxx>
74 #include <docpool.hxx>
75 #include <miscuno.hxx>
76 #include <tablink.hxx>
77 #include <unonames.hxx>
78 #include <unowids.hxx>
79 #include <globstr.hrc>
80 #include <scresid.hxx>
81 #include <cellsuno.hxx>
82 #include <stylehelper.hxx>
84 using namespace ::com::sun::star;
86 static const SfxItemPropertySet* lcl_GetGraphicStyleSet()
88 static const SfxItemPropertyMapEntry aGraphicStyleMap_Impl[] =
90 SVX_UNOEDIT_NUMBERING_PROPERTY,
91 SHADOW_PROPERTIES
92 LINE_PROPERTIES
93 LINE_PROPERTIES_START_END
94 FILL_PROPERTIES
95 EDGERADIUS_PROPERTIES
96 TEXT_PROPERTIES_DEFAULTS
97 CONNECTOR_PROPERTIES
98 SPECIAL_DIMENSIONING_PROPERTIES_DEFAULTS
99 {SC_UNONAME_HIDDEN, ATTR_HIDDEN, cppu::UnoType<sal_Bool>::get(), 0, 0 },
100 {SC_UNONAME_DISPNAME, SC_WID_UNO_DISPNAME, cppu::UnoType<OUString>::get(), beans::PropertyAttribute::READONLY, 0 },
102 static SfxItemPropertySet aGraphicStyleSet_Impl( aGraphicStyleMap_Impl );
103 return &aGraphicStyleSet_Impl;
106 static const SfxItemPropertySet* lcl_GetCellStyleSet()
108 static const SfxItemPropertyMapEntry aCellStyleMap_Impl[] =
110 {SC_UNONAME_ASIANVERT,ATTR_VERTICAL_ASIAN,cppu::UnoType<bool>::get(), 0, 0 },
111 CELL_BORDER_PROPERTIES
112 CELL_BACKGROUND_COLOR_PROPERTIES
113 {SC_UNONAME_CELLPRO, ATTR_PROTECTION, ::cppu::UnoType<util::CellProtection>::get(), 0, 0 },
114 CHAR_COLOR_PROPERTIES
115 {SC_UNONAME_COUTL, ATTR_FONT_CONTOUR, cppu::UnoType<bool>::get(), 0, 0 },
116 {SC_UNONAME_CCROSS, ATTR_FONT_CROSSEDOUT,cppu::UnoType<bool>::get(), 0, MID_CROSSED_OUT },
117 {SC_UNONAME_CEMPHAS, ATTR_FONT_EMPHASISMARK,cppu::UnoType<sal_Int16>::get(), 0, MID_EMPHASIS },
118 {SC_UNONAME_CFONT, ATTR_FONT, ::cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_FAMILY },
119 {SC_UNONAME_CFCHARS, ATTR_FONT, cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_CHAR_SET },
120 {SC_UNO_CJK_CFCHARS, ATTR_CJK_FONT, cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_CHAR_SET },
121 {SC_UNO_CTL_CFCHARS, ATTR_CTL_FONT, cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_CHAR_SET },
122 {SC_UNONAME_CFFAMIL, ATTR_FONT, cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_FAMILY },
123 {SC_UNO_CJK_CFFAMIL, ATTR_CJK_FONT, cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_FAMILY },
124 {SC_UNO_CTL_CFFAMIL, ATTR_CTL_FONT, cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_FAMILY },
125 {SC_UNONAME_CFNAME, ATTR_FONT, cppu::UnoType<OUString>::get(), 0, MID_FONT_FAMILY_NAME },
126 {SC_UNO_CJK_CFNAME, ATTR_CJK_FONT, cppu::UnoType<OUString>::get(), 0, MID_FONT_FAMILY_NAME },
127 {SC_UNO_CTL_CFNAME, ATTR_CTL_FONT, cppu::UnoType<OUString>::get(), 0, MID_FONT_FAMILY_NAME },
128 {SC_UNONAME_CFPITCH, ATTR_FONT, cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_PITCH },
129 {SC_UNO_CJK_CFPITCH, ATTR_CJK_FONT, cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_PITCH },
130 {SC_UNO_CTL_CFPITCH, ATTR_CTL_FONT, cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_PITCH },
131 {SC_UNONAME_CFSTYLE, ATTR_FONT, cppu::UnoType<OUString>::get(), 0, MID_FONT_STYLE_NAME },
132 {SC_UNO_CJK_CFSTYLE, ATTR_CJK_FONT, cppu::UnoType<OUString>::get(), 0, MID_FONT_STYLE_NAME },
133 {SC_UNO_CTL_CFSTYLE, ATTR_CTL_FONT, cppu::UnoType<OUString>::get(), 0, MID_FONT_STYLE_NAME },
134 {SC_UNONAME_CHEIGHT, ATTR_FONT_HEIGHT, ::cppu::UnoType<float>::get(), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
135 {SC_UNO_CJK_CHEIGHT, ATTR_CJK_FONT_HEIGHT,::cppu::UnoType<float>::get(), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
136 {SC_UNO_CTL_CHEIGHT, ATTR_CTL_FONT_HEIGHT,::cppu::UnoType<float>::get(), 0, MID_FONTHEIGHT | CONVERT_TWIPS },
137 {SC_UNONAME_CLOCAL, ATTR_FONT_LANGUAGE, ::cppu::UnoType<lang::Locale>::get(), 0, MID_LANG_LOCALE },
138 {SC_UNO_CJK_CLOCAL, ATTR_CJK_FONT_LANGUAGE,::cppu::UnoType<lang::Locale>::get(), 0, MID_LANG_LOCALE },
139 {SC_UNO_CTL_CLOCAL, ATTR_CTL_FONT_LANGUAGE,::cppu::UnoType<lang::Locale>::get(), 0, MID_LANG_LOCALE },
140 {SC_UNONAME_COVER, ATTR_FONT_OVERLINE, ::cppu::UnoType<sal_Int16>::get(), 0, MID_TL_STYLE },
141 {SC_UNONAME_COVRLCOL, ATTR_FONT_OVERLINE, cppu::UnoType<sal_Int32>::get(), 0, MID_TL_COLOR },
142 {SC_UNONAME_COVRLHAS, ATTR_FONT_OVERLINE, cppu::UnoType<bool>::get(), 0, MID_TL_HASCOLOR },
143 {SC_UNONAME_CPOST, ATTR_FONT_POSTURE, ::cppu::UnoType<awt::FontSlant>::get(), 0, MID_POSTURE },
144 {SC_UNO_CJK_CPOST, ATTR_CJK_FONT_POSTURE,::cppu::UnoType<awt::FontSlant>::get(), 0, MID_POSTURE },
145 {SC_UNO_CTL_CPOST, ATTR_CTL_FONT_POSTURE,::cppu::UnoType<awt::FontSlant>::get(), 0, MID_POSTURE },
146 {SC_UNONAME_CRELIEF, ATTR_FONT_RELIEF, cppu::UnoType<sal_Int16>::get(), 0, MID_RELIEF },
147 {SC_UNONAME_CSHADD, ATTR_FONT_SHADOWED, cppu::UnoType<bool>::get(), 0, 0 },
148 {SC_UNONAME_CSTRIKE, ATTR_FONT_CROSSEDOUT,cppu::UnoType<sal_Int16>::get(), 0, MID_CROSS_OUT },
149 {SC_UNONAME_CUNDER, ATTR_FONT_UNDERLINE,::cppu::UnoType<sal_Int16>::get(), 0, MID_TL_STYLE },
150 {SC_UNONAME_CUNDLCOL, ATTR_FONT_UNDERLINE,cppu::UnoType<sal_Int32>::get(), 0, MID_TL_COLOR },
151 {SC_UNONAME_CUNDLHAS, ATTR_FONT_UNDERLINE,cppu::UnoType<bool>::get(), 0, MID_TL_HASCOLOR },
152 {SC_UNONAME_CWEIGHT, ATTR_FONT_WEIGHT, ::cppu::UnoType<float>::get(), 0, MID_WEIGHT },
153 {SC_UNO_CJK_CWEIGHT, ATTR_CJK_FONT_WEIGHT,::cppu::UnoType<float>::get(), 0, MID_WEIGHT },
154 {SC_UNO_CTL_CWEIGHT, ATTR_CTL_FONT_WEIGHT,::cppu::UnoType<float>::get(), 0, MID_WEIGHT },
155 {SC_UNONAME_CWORDMOD, ATTR_FONT_WORDLINE, cppu::UnoType<bool>::get(), 0, 0 },
156 {SC_UNONAME_DIAGONAL_BLTR, ATTR_BORDER_BLTR, ::cppu::UnoType<table::BorderLine>::get(), 0, 0 | CONVERT_TWIPS },
157 {SC_UNONAME_DIAGONAL_BLTR2, ATTR_BORDER_BLTR, ::cppu::UnoType<table::BorderLine2>::get(), 0, 0 | CONVERT_TWIPS },
158 {SC_UNONAME_DIAGONAL_TLBR, ATTR_BORDER_TLBR, ::cppu::UnoType<table::BorderLine>::get(), 0, 0 | CONVERT_TWIPS },
159 {SC_UNONAME_DIAGONAL_TLBR2, ATTR_BORDER_TLBR, ::cppu::UnoType<table::BorderLine2>::get(), 0, 0 | CONVERT_TWIPS },
160 {SC_UNONAME_DISPNAME, SC_WID_UNO_DISPNAME,::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::READONLY, 0 },
161 {SC_UNONAME_CELLHJUS, ATTR_HOR_JUSTIFY, ::cppu::UnoType<table::CellHoriJustify>::get(), 0, MID_HORJUST_HORJUST },
162 {SC_UNONAME_CELLHJUS_METHOD, ATTR_HOR_JUSTIFY_METHOD, ::cppu::UnoType<sal_Int32>::get(), 0, 0 },
163 {SC_UNONAME_CELLTRAN, ATTR_BACKGROUND, cppu::UnoType<bool>::get(), 0, MID_GRAPHIC_TRANSPARENT },
164 {SC_UNONAME_WRAP, ATTR_LINEBREAK, cppu::UnoType<bool>::get(), 0, 0 },
165 {SC_UNONAME_NUMFMT, ATTR_VALUE_FORMAT, ::cppu::UnoType<sal_Int32>::get(), 0, 0 },
166 // {SC_UNONAME_NUMRULES, SC_WID_UNO_NUMRULES,cppu::UnoType<container::XIndexReplace>::get(), 0, 0 },
167 {SC_UNONAME_CELLORI, ATTR_STACKED, ::cppu::UnoType<table::CellOrientation>::get(), 0, 0 },
168 {SC_UNONAME_PADJUST, ATTR_HOR_JUSTIFY, ::cppu::UnoType<sal_Int16>::get(), 0, MID_HORJUST_ADJUST },
169 {SC_UNONAME_PBMARGIN, ATTR_MARGIN, ::cppu::UnoType<sal_Int32>::get(), 0, MID_MARGIN_LO_MARGIN | CONVERT_TWIPS },
170 {SC_UNONAME_PINDENT, ATTR_INDENT, ::cppu::UnoType<sal_Int16>::get(), 0, 0 }, //! CONVERT_TWIPS
171 {SC_UNONAME_PISCHDIST,ATTR_SCRIPTSPACE, cppu::UnoType<bool>::get(), 0, 0 },
172 {SC_UNONAME_PISFORBID,ATTR_FORBIDDEN_RULES,cppu::UnoType<bool>::get(), 0, 0 },
173 {SC_UNONAME_PISHANG, ATTR_HANGPUNCTUATION,cppu::UnoType<bool>::get(), 0, 0 },
174 {SC_UNONAME_PISHYPHEN,ATTR_HYPHENATE, cppu::UnoType<bool>::get(), 0, 0 },
175 {SC_UNONAME_PLASTADJ, ATTR_HOR_JUSTIFY, ::cppu::UnoType<sal_Int16>::get(), 0, MID_HORJUST_ADJUST },
176 {SC_UNONAME_PLMARGIN, ATTR_MARGIN, ::cppu::UnoType<sal_Int32>::get(), 0, MID_MARGIN_L_MARGIN | CONVERT_TWIPS },
177 {SC_UNONAME_PRMARGIN, ATTR_MARGIN, ::cppu::UnoType<sal_Int32>::get(), 0, MID_MARGIN_R_MARGIN | CONVERT_TWIPS },
178 {SC_UNONAME_PTMARGIN, ATTR_MARGIN, ::cppu::UnoType<sal_Int32>::get(), 0, MID_MARGIN_UP_MARGIN | CONVERT_TWIPS },
179 {SC_UNONAME_ROTANG, ATTR_ROTATE_VALUE, ::cppu::UnoType<sal_Int32>::get(), 0, 0 },
180 {SC_UNONAME_ROTREF, ATTR_ROTATE_MODE, ::cppu::UnoType<sal_Int32>::get(), 0, 0 },
181 {SC_UNONAME_SHADOW, ATTR_SHADOW, ::cppu::UnoType<table::ShadowFormat>::get(), 0, 0 | CONVERT_TWIPS },
182 {SC_UNONAME_SHRINK_TO_FIT, ATTR_SHRINKTOFIT, cppu::UnoType<bool>::get(), 0, 0 },
183 {SC_UNONAME_TBLBORD, SC_WID_UNO_TBLBORD, ::cppu::UnoType<table::TableBorder>::get(), 0, 0 | CONVERT_TWIPS },
184 {SC_UNONAME_TBLBORD, SC_WID_UNO_TBLBORD2, ::cppu::UnoType<table::TableBorder2>::get(), 0, 0 | CONVERT_TWIPS },
185 {SC_UNONAME_USERDEF, ATTR_USERDEF, cppu::UnoType<container::XNameContainer>::get(), 0, 0 },
186 {SC_UNONAME_CELLVJUS, ATTR_VER_JUSTIFY, ::cppu::UnoType<sal_Int32>::get(), 0, 0 },
187 {SC_UNONAME_CELLVJUS_METHOD, ATTR_VER_JUSTIFY_METHOD, ::cppu::UnoType<sal_Int32>::get(), 0, 0 },
188 {SC_UNONAME_WRITING, ATTR_WRITINGDIR, cppu::UnoType<sal_Int16>::get(), 0, 0 },
189 {SC_UNONAME_HIDDEN, ATTR_HIDDEN, cppu::UnoType<sal_Bool>::get(), 0, 0 },
190 {SC_UNONAME_HYPERLINK, ATTR_HYPERLINK, cppu::UnoType<OUString>::get(), 0, 0 },
192 static SfxItemPropertySet aCellStyleSet_Impl( aCellStyleMap_Impl );
193 return &aCellStyleSet_Impl;
196 // map with all site attributes including header and footer attributes
198 static const SfxItemPropertySet * lcl_GetPageStyleSet()
200 static const SfxItemPropertyMapEntry aPageStyleMap_Impl[] =
202 {SC_UNO_PAGE_BACKCOLOR, ATTR_BACKGROUND, ::cppu::UnoType<sal_Int32>::get(), 0, MID_BACK_COLOR },
203 {SC_UNO_PAGE_GRAPHICFILT, ATTR_BACKGROUND, ::cppu::UnoType<OUString>::get(), 0, MID_GRAPHIC_FILTER },
204 {SC_UNO_PAGE_GRAPHICLOC, ATTR_BACKGROUND, ::cppu::UnoType<style::GraphicLocation>::get(), 0, MID_GRAPHIC_POSITION },
205 {SC_UNO_PAGE_GRAPHICURL, ATTR_BACKGROUND, ::cppu::UnoType<OUString>::get(), 0, MID_GRAPHIC_URL },
206 {SC_UNO_PAGE_GRAPHIC, ATTR_BACKGROUND, ::cppu::UnoType<graphic::XGraphic>::get(), 0, MID_GRAPHIC },
207 {SC_UNO_PAGE_BACKTRANS, ATTR_BACKGROUND, cppu::UnoType<bool>::get(), 0, MID_GRAPHIC_TRANSPARENT },
208 {OLD_UNO_PAGE_BACKCOLOR, ATTR_BACKGROUND, ::cppu::UnoType<sal_Int32>::get(), 0, MID_BACK_COLOR },
209 {SC_UNO_PAGE_BORDERDIST, ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, BORDER_DISTANCE | CONVERT_TWIPS },
210 {SC_UNO_PAGE_BOTTBORDER, ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, BOTTOM_BORDER | CONVERT_TWIPS },
211 {SC_UNO_PAGE_BOTTBRDDIST, ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, BOTTOM_BORDER_DISTANCE | CONVERT_TWIPS },
212 {SC_UNO_PAGE_BOTTMARGIN, ATTR_ULSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_LO_MARGIN | CONVERT_TWIPS },
213 {SC_UNO_PAGE_CENTERHOR, ATTR_PAGE_HORCENTER,cppu::UnoType<bool>::get(), 0, 0 },
214 {SC_UNO_PAGE_CENTERVER, ATTR_PAGE_VERCENTER,cppu::UnoType<bool>::get(), 0, 0 },
215 {SC_UNONAME_DISPNAME, SC_WID_UNO_DISPNAME,::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::READONLY, 0 },
216 {SC_UNO_PAGE_FIRSTPAGE, ATTR_PAGE_FIRSTPAGENO,::cppu::UnoType<sal_Int16>::get(), 0, 0 },
217 {SC_UNO_PAGE_FIRSTFTRSHARED, SC_WID_UNO_FOOTERSET,cppu::UnoType<bool>::get(), 0, 0 },
218 {SC_UNO_PAGE_FIRSTHDRSHARED, SC_WID_UNO_HEADERSET,cppu::UnoType<bool>::get(), 0, 0 },
219 {SC_UNO_PAGE_FIRSTFTRCONT, ATTR_PAGE_FOOTERFIRST,cppu::UnoType<sheet::XHeaderFooterContent>::get(), 0, 0 },
220 {SC_UNO_PAGE_FIRSTHDRCONT, ATTR_PAGE_HEADERFIRST,cppu::UnoType<sheet::XHeaderFooterContent>::get(), 0, 0 },
222 {SC_UNO_PAGE_FTRBACKCOL, SC_WID_UNO_FOOTERSET,::cppu::UnoType<sal_Int32>::get(), 0, 0 },
223 {SC_UNO_PAGE_FTRGRFFILT, SC_WID_UNO_FOOTERSET,::cppu::UnoType<OUString>::get(), 0, 0 },
224 {SC_UNO_PAGE_FTRGRFLOC, SC_WID_UNO_FOOTERSET,::cppu::UnoType<style::GraphicLocation>::get(), 0, 0 },
225 {SC_UNO_PAGE_FTRGRFURL, SC_WID_UNO_FOOTERSET,::cppu::UnoType<OUString>::get(), 0, 0 },
226 {SC_UNO_PAGE_FTRGRF, SC_WID_UNO_FOOTERSET,::cppu::UnoType<graphic::XGraphic>::get(), 0, 0 },
227 {SC_UNO_PAGE_FTRBACKTRAN, SC_WID_UNO_FOOTERSET,cppu::UnoType<bool>::get(), 0, 0 },
228 {OLD_UNO_PAGE_FTRBACKCOL, SC_WID_UNO_FOOTERSET,::cppu::UnoType<sal_Int32>::get(), 0, 0 },
229 {SC_UNO_PAGE_FTRBODYDIST, SC_WID_UNO_FOOTERSET,::cppu::UnoType<sal_Int32>::get(), 0, 0 },
230 {SC_UNO_PAGE_FTRBRDDIST, SC_WID_UNO_FOOTERSET,::cppu::UnoType<sal_Int32>::get(), 0, 0 },
231 {SC_UNO_PAGE_FTRBOTTBOR, SC_WID_UNO_FOOTERSET,::cppu::UnoType<table::BorderLine>::get(), 0, 0 },
232 {SC_UNO_PAGE_FTRBOTTBDIS, SC_WID_UNO_FOOTERSET,::cppu::UnoType<sal_Int32>::get(), 0, 0 },
233 {OLD_UNO_PAGE_FTRDYNAMIC, SC_WID_UNO_FOOTERSET,cppu::UnoType<bool>::get(), 0, 0 },
234 {SC_UNO_PAGE_FTRHEIGHT, SC_WID_UNO_FOOTERSET,::cppu::UnoType<sal_Int32>::get(), 0, 0 },
235 {SC_UNO_PAGE_FTRDYNAMIC, SC_WID_UNO_FOOTERSET,cppu::UnoType<bool>::get(), 0, 0 },
236 {SC_UNO_PAGE_FTRON, SC_WID_UNO_FOOTERSET,cppu::UnoType<bool>::get(), 0, 0 },
237 {SC_UNO_PAGE_FTRSHARED, SC_WID_UNO_FOOTERSET,cppu::UnoType<bool>::get(), 0, 0 },
238 {SC_UNO_PAGE_FTRLEFTBOR, SC_WID_UNO_FOOTERSET,::cppu::UnoType<table::BorderLine>::get(), 0, 0 },
239 {SC_UNO_PAGE_FTRLEFTBDIS, SC_WID_UNO_FOOTERSET,::cppu::UnoType<sal_Int32>::get(), 0, 0 },
240 {SC_UNO_PAGE_FTRLEFTMAR, SC_WID_UNO_FOOTERSET,::cppu::UnoType<sal_Int32>::get(), 0, 0 },
241 {OLD_UNO_PAGE_FTRON, SC_WID_UNO_FOOTERSET,cppu::UnoType<bool>::get(), 0, 0 },
242 {SC_UNO_PAGE_FTRRIGHTBOR, SC_WID_UNO_FOOTERSET,::cppu::UnoType<table::BorderLine>::get(), 0, 0 },
243 {SC_UNO_PAGE_FTRRIGHTBDIS,SC_WID_UNO_FOOTERSET,::cppu::UnoType<sal_Int32>::get(), 0, 0 },
244 {SC_UNO_PAGE_FTRRIGHTMAR, SC_WID_UNO_FOOTERSET,::cppu::UnoType<sal_Int32>::get(), 0, 0 },
245 {SC_UNO_PAGE_FTRSHADOW, SC_WID_UNO_FOOTERSET,::cppu::UnoType<table::ShadowFormat>::get(), 0, 0 },
246 {OLD_UNO_PAGE_FTRSHARED, SC_WID_UNO_FOOTERSET,cppu::UnoType<bool>::get(), 0, 0 },
247 {SC_UNO_PAGE_FTRTOPBOR, SC_WID_UNO_FOOTERSET,::cppu::UnoType<table::BorderLine>::get(), 0, 0 },
248 {SC_UNO_PAGE_FTRTOPBDIS, SC_WID_UNO_FOOTERSET,::cppu::UnoType<sal_Int32>::get(), 0, 0 },
250 {SC_UNO_PAGE_HDRBACKCOL, SC_WID_UNO_HEADERSET,::cppu::UnoType<sal_Int32>::get(), 0, 0 },
251 {SC_UNO_PAGE_HDRGRFFILT, SC_WID_UNO_HEADERSET,::cppu::UnoType<OUString>::get(), 0, 0 },
252 {SC_UNO_PAGE_HDRGRFLOC, SC_WID_UNO_HEADERSET,::cppu::UnoType<style::GraphicLocation>::get(), 0, 0 },
253 {SC_UNO_PAGE_HDRGRFURL, SC_WID_UNO_HEADERSET,::cppu::UnoType<OUString>::get(), 0, 0 },
254 {SC_UNO_PAGE_HDRGRF, SC_WID_UNO_HEADERSET,::cppu::UnoType<graphic::XGraphic>::get(), 0, 0 },
255 {SC_UNO_PAGE_HDRBACKTRAN, SC_WID_UNO_HEADERSET,cppu::UnoType<bool>::get(), 0, 0 },
256 {OLD_UNO_PAGE_HDRBACKCOL, SC_WID_UNO_HEADERSET,::cppu::UnoType<sal_Int32>::get(), 0, 0 },
257 {SC_UNO_PAGE_HDRBODYDIST, SC_WID_UNO_HEADERSET,::cppu::UnoType<sal_Int32>::get(), 0, 0 },
258 {SC_UNO_PAGE_HDRBRDDIST, SC_WID_UNO_HEADERSET,::cppu::UnoType<sal_Int32>::get(), 0, 0 },
259 {SC_UNO_PAGE_HDRBOTTBOR, SC_WID_UNO_HEADERSET,::cppu::UnoType<table::BorderLine>::get(), 0, 0 },
260 {SC_UNO_PAGE_HDRBOTTBDIS, SC_WID_UNO_HEADERSET,::cppu::UnoType<sal_Int32>::get(), 0, 0 },
261 {OLD_UNO_PAGE_HDRDYNAMIC, SC_WID_UNO_HEADERSET,cppu::UnoType<bool>::get(), 0, 0 },
262 {SC_UNO_PAGE_HDRHEIGHT, SC_WID_UNO_HEADERSET,::cppu::UnoType<sal_Int32>::get(), 0, 0 },
263 {SC_UNO_PAGE_HDRDYNAMIC, SC_WID_UNO_HEADERSET,cppu::UnoType<bool>::get(), 0, 0 },
264 {SC_UNO_PAGE_HDRON, SC_WID_UNO_HEADERSET,cppu::UnoType<bool>::get(), 0, 0 },
265 {SC_UNO_PAGE_HDRSHARED, SC_WID_UNO_HEADERSET,cppu::UnoType<bool>::get(), 0, 0 },
266 {SC_UNO_PAGE_HDRLEFTBOR, SC_WID_UNO_HEADERSET,::cppu::UnoType<table::BorderLine>::get(), 0, 0 },
267 {SC_UNO_PAGE_HDRLEFTBDIS, SC_WID_UNO_HEADERSET,::cppu::UnoType<sal_Int32>::get(), 0, 0 },
268 {SC_UNO_PAGE_HDRLEFTMAR, SC_WID_UNO_HEADERSET,::cppu::UnoType<sal_Int32>::get(), 0, 0 },
269 {OLD_UNO_PAGE_HDRON, SC_WID_UNO_HEADERSET,cppu::UnoType<bool>::get(), 0, 0 },
270 {SC_UNO_PAGE_HDRRIGHTBOR, SC_WID_UNO_HEADERSET,::cppu::UnoType<table::BorderLine>::get(), 0, 0 },
271 {SC_UNO_PAGE_HDRRIGHTBDIS,SC_WID_UNO_HEADERSET,::cppu::UnoType<sal_Int32>::get(), 0, 0 },
272 {SC_UNO_PAGE_HDRRIGHTMAR, SC_WID_UNO_HEADERSET,::cppu::UnoType<sal_Int32>::get(), 0, 0 },
273 {SC_UNO_PAGE_HDRSHADOW, SC_WID_UNO_HEADERSET,::cppu::UnoType<table::ShadowFormat>::get(), 0, 0 },
274 {OLD_UNO_PAGE_HDRSHARED, SC_WID_UNO_HEADERSET,cppu::UnoType<bool>::get(), 0, 0 },
275 {SC_UNO_PAGE_HDRTOPBOR, SC_WID_UNO_HEADERSET,::cppu::UnoType<table::BorderLine>::get(), 0, 0 },
276 {SC_UNO_PAGE_HDRTOPBDIS, SC_WID_UNO_HEADERSET,::cppu::UnoType<sal_Int32>::get(), 0, 0 },
278 {SC_UNO_PAGE_HEIGHT, ATTR_PAGE_SIZE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_SIZE_HEIGHT | CONVERT_TWIPS },
279 {OLD_UNO_PAGE_BACKTRANS, ATTR_BACKGROUND, cppu::UnoType<bool>::get(), 0, MID_GRAPHIC_TRANSPARENT },
280 {SC_UNO_PAGE_LANDSCAPE, ATTR_PAGE, cppu::UnoType<bool>::get(), 0, MID_PAGE_ORIENTATION },
281 {SC_UNO_PAGE_LEFTBORDER, ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, LEFT_BORDER | CONVERT_TWIPS },
282 {SC_UNO_PAGE_LEFTBRDDIST, ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, LEFT_BORDER_DISTANCE | CONVERT_TWIPS },
283 {SC_UNO_PAGE_LEFTMARGIN, ATTR_LRSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_L_MARGIN | CONVERT_TWIPS },
284 {SC_UNO_PAGE_LEFTFTRCONT, ATTR_PAGE_FOOTERLEFT,cppu::UnoType<sheet::XHeaderFooterContent>::get(), 0, 0 },
285 {SC_UNO_PAGE_LEFTHDRCONT, ATTR_PAGE_HEADERLEFT,cppu::UnoType<sheet::XHeaderFooterContent>::get(), 0, 0 },
286 {SC_UNO_PAGE_NUMBERTYPE, ATTR_PAGE, ::cppu::UnoType<sal_Int16>::get(), 0, MID_PAGE_NUMTYPE },
287 {SC_UNO_PAGE_SCALEVAL, ATTR_PAGE_SCALE, ::cppu::UnoType<sal_Int16>::get(), 0, 0 },
288 {SC_UNO_PAGE_SYTLELAYOUT, ATTR_PAGE, ::cppu::UnoType<style::PageStyleLayout>::get(), 0, MID_PAGE_LAYOUT },
289 {SC_UNO_PAGE_PRINTANNOT, ATTR_PAGE_NOTES, cppu::UnoType<bool>::get(), 0, 0 },
290 {SC_UNO_PAGE_PRINTCHARTS, ATTR_PAGE_CHARTS, cppu::UnoType<bool>::get(), 0, 0 },
291 {SC_UNO_PAGE_PRINTDOWN, ATTR_PAGE_TOPDOWN, cppu::UnoType<bool>::get(), 0, 0 },
292 {SC_UNO_PAGE_PRINTDRAW, ATTR_PAGE_DRAWINGS, cppu::UnoType<bool>::get(), 0, 0 },
293 {SC_UNO_PAGE_PRINTFORMUL, ATTR_PAGE_FORMULAS, cppu::UnoType<bool>::get(), 0, 0 },
294 {SC_UNO_PAGE_PRINTGRID, ATTR_PAGE_GRID, cppu::UnoType<bool>::get(), 0, 0 },
295 {SC_UNO_PAGE_PRINTHEADER, ATTR_PAGE_HEADERS, cppu::UnoType<bool>::get(), 0, 0 },
296 {SC_UNO_PAGE_PRINTOBJS, ATTR_PAGE_OBJECTS, cppu::UnoType<bool>::get(), 0, 0 },
297 {SC_UNO_PAGE_PRINTZERO, ATTR_PAGE_NULLVALS, cppu::UnoType<bool>::get(), 0, 0 },
298 {SC_UNO_PAGE_PAPERTRAY, ATTR_PAGE_PAPERBIN, ::cppu::UnoType<OUString>::get(), 0, 0 },
299 {SC_UNO_PAGE_RIGHTBORDER, ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, RIGHT_BORDER | CONVERT_TWIPS },
300 {SC_UNO_PAGE_RIGHTBRDDIST,ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, RIGHT_BORDER_DISTANCE | CONVERT_TWIPS },
301 {SC_UNO_PAGE_RIGHTMARGIN, ATTR_LRSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_R_MARGIN | CONVERT_TWIPS },
302 {SC_UNO_PAGE_RIGHTFTRCON, ATTR_PAGE_FOOTERRIGHT,cppu::UnoType<sheet::XHeaderFooterContent>::get(), 0, 0 },
303 {SC_UNO_PAGE_RIGHTHDRCON, ATTR_PAGE_HEADERRIGHT,cppu::UnoType<sheet::XHeaderFooterContent>::get(), 0, 0 },
304 {SC_UNO_PAGE_SCALETOPAG, ATTR_PAGE_SCALETOPAGES,::cppu::UnoType<sal_Int16>::get(), 0, 0 },
305 {SC_UNO_PAGE_SCALETOX, ATTR_PAGE_SCALETO, ::cppu::UnoType<sal_Int16>::get(), 0, 0 },
306 {SC_UNO_PAGE_SCALETOY, ATTR_PAGE_SCALETO, ::cppu::UnoType<sal_Int16>::get(), 0, 0 },
307 {SC_UNO_PAGE_SHADOWFORM, ATTR_SHADOW, ::cppu::UnoType<table::ShadowFormat>::get(), 0, 0 | CONVERT_TWIPS },
308 {SC_UNO_PAGE_SIZE, ATTR_PAGE_SIZE, ::cppu::UnoType<awt::Size>::get(), 0, MID_SIZE_SIZE | CONVERT_TWIPS },
309 {SC_UNO_PAGE_TOPBORDER, ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, TOP_BORDER | CONVERT_TWIPS },
310 {SC_UNO_PAGE_TOPBRDDIST, ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, TOP_BORDER_DISTANCE | CONVERT_TWIPS },
311 {SC_UNO_PAGE_TOPMARGIN, ATTR_ULSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_UP_MARGIN | CONVERT_TWIPS },
312 {OLD_UNO_PAGE_FTRBACKTRAN,SC_WID_UNO_FOOTERSET,cppu::UnoType<bool>::get(), 0, 0 },
313 {OLD_UNO_PAGE_HDRBACKTRAN,SC_WID_UNO_HEADERSET,cppu::UnoType<bool>::get(), 0, 0 },
314 {SC_UNONAME_USERDEF, ATTR_USERDEF, cppu::UnoType<container::XNameContainer>::get(), 0, 0 },
315 {SC_UNO_PAGE_WIDTH, ATTR_PAGE_SIZE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_SIZE_WIDTH | CONVERT_TWIPS },
316 {SC_UNONAME_WRITING, ATTR_WRITINGDIR, cppu::UnoType<sal_Int16>::get(), 0, 0 },
317 {SC_UNONAME_HIDDEN, ATTR_HIDDEN, cppu::UnoType<sal_Bool>::get(), 0, 0 },
319 static SfxItemPropertySet aPageStyleSet_Impl( aPageStyleMap_Impl );
320 return &aPageStyleSet_Impl;
323 // map with content of the Header-Item-Sets
325 static const SfxItemPropertyMap* lcl_GetHeaderStyleMap()
327 static const SfxItemPropertyMapEntry aHeaderStyleMap_Impl[] =
329 {SC_UNO_PAGE_HDRBACKCOL, ATTR_BACKGROUND, ::cppu::UnoType<sal_Int32>::get(), 0, MID_BACK_COLOR },
330 {SC_UNO_PAGE_HDRGRFFILT, ATTR_BACKGROUND, ::cppu::UnoType<OUString>::get(), 0, MID_GRAPHIC_FILTER },
331 {SC_UNO_PAGE_HDRGRFLOC, ATTR_BACKGROUND, ::cppu::UnoType<style::GraphicLocation>::get(), 0, MID_GRAPHIC_POSITION },
332 {SC_UNO_PAGE_HDRGRFURL, ATTR_BACKGROUND, ::cppu::UnoType<OUString>::get(), 0, MID_GRAPHIC_URL },
333 {SC_UNO_PAGE_HDRGRF, ATTR_BACKGROUND, ::cppu::UnoType<graphic::XGraphic>::get(), 0, MID_GRAPHIC },
334 {SC_UNO_PAGE_HDRBACKTRAN, ATTR_BACKGROUND, cppu::UnoType<bool>::get(), 0, MID_GRAPHIC_TRANSPARENT },
335 {OLD_UNO_PAGE_HDRBACKCOL, ATTR_BACKGROUND, ::cppu::UnoType<sal_Int32>::get(), 0, MID_BACK_COLOR },
336 {SC_UNO_PAGE_HDRBODYDIST, ATTR_ULSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_LO_MARGIN | CONVERT_TWIPS },
337 {SC_UNO_PAGE_HDRBRDDIST, ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, BORDER_DISTANCE | CONVERT_TWIPS },
338 {SC_UNO_PAGE_HDRBOTTBOR, ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, BOTTOM_BORDER | CONVERT_TWIPS },
339 {SC_UNO_PAGE_HDRBOTTBDIS, ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, BOTTOM_BORDER_DISTANCE | CONVERT_TWIPS },
340 {OLD_UNO_PAGE_HDRDYNAMIC, ATTR_PAGE_DYNAMIC, cppu::UnoType<bool>::get(), 0, 0 },
341 {SC_UNO_PAGE_HDRHEIGHT, ATTR_PAGE_SIZE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_SIZE_HEIGHT | CONVERT_TWIPS },
342 {SC_UNO_PAGE_HDRDYNAMIC, ATTR_PAGE_DYNAMIC, cppu::UnoType<bool>::get(), 0, 0 },
343 {SC_UNO_PAGE_HDRON, ATTR_PAGE_ON, cppu::UnoType<bool>::get(), 0, 0 },
344 {SC_UNO_PAGE_HDRSHARED, ATTR_PAGE_SHARED, cppu::UnoType<bool>::get(), 0, 0 },
345 {SC_UNO_PAGE_FIRSTHDRSHARED, ATTR_PAGE_SHARED_FIRST, cppu::UnoType<bool>::get(), 0, 0 },
346 {SC_UNO_PAGE_HDRLEFTBOR, ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, LEFT_BORDER | CONVERT_TWIPS },
347 {SC_UNO_PAGE_HDRLEFTBDIS, ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, LEFT_BORDER_DISTANCE | CONVERT_TWIPS },
348 {SC_UNO_PAGE_HDRLEFTMAR, ATTR_LRSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_L_MARGIN | CONVERT_TWIPS },
349 {OLD_UNO_PAGE_HDRON, ATTR_PAGE_ON, cppu::UnoType<bool>::get(), 0, 0 },
350 {SC_UNO_PAGE_HDRRIGHTBOR, ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, RIGHT_BORDER | CONVERT_TWIPS },
351 {SC_UNO_PAGE_HDRRIGHTBDIS,ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, RIGHT_BORDER_DISTANCE | CONVERT_TWIPS },
352 {SC_UNO_PAGE_HDRRIGHTMAR, ATTR_LRSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_R_MARGIN | CONVERT_TWIPS },
353 {SC_UNO_PAGE_HDRSHADOW, ATTR_SHADOW, ::cppu::UnoType<table::ShadowFormat>::get(), 0, 0 | CONVERT_TWIPS },
354 {OLD_UNO_PAGE_HDRSHARED, ATTR_PAGE_SHARED, cppu::UnoType<bool>::get(), 0, 0 },
355 {SC_UNO_PAGE_HDRTOPBOR, ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, TOP_BORDER | CONVERT_TWIPS },
356 {SC_UNO_PAGE_HDRTOPBDIS, ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, TOP_BORDER_DISTANCE | CONVERT_TWIPS },
357 {OLD_UNO_PAGE_HDRBACKTRAN,ATTR_BACKGROUND, cppu::UnoType<bool>::get(), 0, MID_GRAPHIC_TRANSPARENT },
359 static SfxItemPropertyMap aHeaderStyleMap( aHeaderStyleMap_Impl );
360 return &aHeaderStyleMap;
363 // map with content of the Footer-Item-Sets
365 static const SfxItemPropertyMap* lcl_GetFooterStyleMap()
367 static const SfxItemPropertyMapEntry aFooterStyleMap_Impl[] =
369 {SC_UNO_PAGE_FTRBACKCOL, ATTR_BACKGROUND, ::cppu::UnoType<sal_Int32>::get(), 0, MID_BACK_COLOR },
370 {SC_UNO_PAGE_FTRGRFFILT, ATTR_BACKGROUND, ::cppu::UnoType<OUString>::get(), 0, MID_GRAPHIC_FILTER },
371 {SC_UNO_PAGE_FTRGRFLOC, ATTR_BACKGROUND, ::cppu::UnoType<style::GraphicLocation>::get(), 0, MID_GRAPHIC_POSITION },
372 {SC_UNO_PAGE_FTRGRFURL, ATTR_BACKGROUND, ::cppu::UnoType<OUString>::get(), 0, MID_GRAPHIC_URL },
373 {SC_UNO_PAGE_FTRGRF, ATTR_BACKGROUND, ::cppu::UnoType<graphic::XGraphic>::get(), 0, MID_GRAPHIC },
374 {SC_UNO_PAGE_FTRBACKTRAN, ATTR_BACKGROUND, cppu::UnoType<bool>::get(), 0, MID_GRAPHIC_TRANSPARENT },
375 {OLD_UNO_PAGE_FTRBACKCOL, ATTR_BACKGROUND, ::cppu::UnoType<sal_Int32>::get(), 0, MID_BACK_COLOR },
376 {SC_UNO_PAGE_FTRBODYDIST, ATTR_ULSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_UP_MARGIN | CONVERT_TWIPS },
377 {SC_UNO_PAGE_FTRBRDDIST, ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, BORDER_DISTANCE | CONVERT_TWIPS },
378 {SC_UNO_PAGE_FTRBOTTBOR, ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, BOTTOM_BORDER | CONVERT_TWIPS },
379 {SC_UNO_PAGE_FTRBOTTBDIS, ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, BOTTOM_BORDER_DISTANCE | CONVERT_TWIPS },
380 {OLD_UNO_PAGE_FTRDYNAMIC, ATTR_PAGE_DYNAMIC, cppu::UnoType<bool>::get(), 0, 0 },
381 {SC_UNO_PAGE_FTRHEIGHT, ATTR_PAGE_SIZE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_SIZE_HEIGHT | CONVERT_TWIPS },
382 {SC_UNO_PAGE_FTRDYNAMIC, ATTR_PAGE_DYNAMIC, cppu::UnoType<bool>::get(), 0, 0 },
383 {SC_UNO_PAGE_FTRON, ATTR_PAGE_ON, cppu::UnoType<bool>::get(), 0, 0 },
384 {SC_UNO_PAGE_FTRSHARED, ATTR_PAGE_SHARED, cppu::UnoType<bool>::get(), 0, 0 },
385 {SC_UNO_PAGE_FIRSTFTRSHARED, ATTR_PAGE_SHARED_FIRST, cppu::UnoType<bool>::get(), 0, 0 },
386 {SC_UNO_PAGE_FTRLEFTBOR, ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, LEFT_BORDER | CONVERT_TWIPS },
387 {SC_UNO_PAGE_FTRLEFTBDIS, ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, LEFT_BORDER_DISTANCE | CONVERT_TWIPS },
388 {SC_UNO_PAGE_FTRLEFTMAR, ATTR_LRSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_L_MARGIN | CONVERT_TWIPS },
389 {OLD_UNO_PAGE_FTRON, ATTR_PAGE_ON, cppu::UnoType<bool>::get(), 0, 0 },
390 {SC_UNO_PAGE_FTRRIGHTBOR, ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, RIGHT_BORDER | CONVERT_TWIPS },
391 {SC_UNO_PAGE_FTRRIGHTBDIS,ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, RIGHT_BORDER_DISTANCE | CONVERT_TWIPS },
392 {SC_UNO_PAGE_FTRRIGHTMAR, ATTR_LRSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_R_MARGIN | CONVERT_TWIPS },
393 {SC_UNO_PAGE_FTRSHADOW, ATTR_SHADOW, ::cppu::UnoType<table::ShadowFormat>::get(), 0, 0 | CONVERT_TWIPS },
394 {OLD_UNO_PAGE_FTRSHARED, ATTR_PAGE_SHARED, cppu::UnoType<bool>::get(), 0, 0 },
395 {SC_UNO_PAGE_FTRTOPBOR, ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, TOP_BORDER | CONVERT_TWIPS },
396 {SC_UNO_PAGE_FTRTOPBDIS, ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, TOP_BORDER_DISTANCE | CONVERT_TWIPS },
397 {OLD_UNO_PAGE_FTRBACKTRAN,ATTR_BACKGROUND, cppu::UnoType<bool>::get(), 0, MID_GRAPHIC_TRANSPARENT },
399 static SfxItemPropertyMap aFooterStyleMap( aFooterStyleMap_Impl );
400 return &aFooterStyleMap;
403 // access index on the style types: 0 = Cell, 1 = Page, 2 = Drawing
405 #define SC_STYLE_FAMILY_COUNT 3
407 constexpr OUString SC_FAMILYNAME_CELL = u"CellStyles"_ustr;
408 constexpr OUString SC_FAMILYNAME_PAGE = u"PageStyles"_ustr;
409 constexpr OUString SC_FAMILYNAME_GRAPHIC = u"GraphicStyles"_ustr;
411 const SfxStyleFamily aStyleFamilyTypes[SC_STYLE_FAMILY_COUNT] = { SfxStyleFamily::Para, SfxStyleFamily::Page, SfxStyleFamily::Frame };
413 constexpr OUString SCSTYLE_SERVICE = u"com.sun.star.style.Style"_ustr;
414 constexpr OUString SCCELLSTYLE_SERVICE = u"com.sun.star.style.CellStyle"_ustr;
415 constexpr OUString SCPAGESTYLE_SERVICE = u"com.sun.star.style.PageStyle"_ustr;
416 constexpr OUString SCGRAPHICSTYLE_SERVICE = u"com.sun.star.style.GraphicStyle"_ustr;
418 SC_SIMPLE_SERVICE_INFO( ScStyleFamiliesObj, u"ScStyleFamiliesObj"_ustr, u"com.sun.star.style.StyleFamilies"_ustr )
419 SC_SIMPLE_SERVICE_INFO( ScStyleFamilyObj, u"ScStyleFamilyObj"_ustr, u"com.sun.star.style.StyleFamily"_ustr )
421 constexpr OUString SC_PAPERBIN_DEFAULTNAME = u"[From printer settings]"_ustr;
423 static bool lcl_AnyTabProtected( const ScDocument& rDoc )
425 SCTAB nTabCount = rDoc.GetTableCount();
426 for (SCTAB i=0; i<nTabCount; i++)
427 if (rDoc.IsTabProtected(i))
428 return true;
429 return false;
432 ScStyleFamiliesObj::ScStyleFamiliesObj(ScDocShell* pDocSh) :
433 pDocShell( pDocSh )
435 pDocShell->GetDocument().AddUnoObject(*this);
438 ScStyleFamiliesObj::~ScStyleFamiliesObj()
440 SolarMutexGuard g;
442 if (pDocShell)
443 pDocShell->GetDocument().RemoveUnoObject(*this);
446 void ScStyleFamiliesObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
448 // reference update does not matter here
450 if ( rHint.GetId() == SfxHintId::Dying )
452 pDocShell = nullptr;
456 // XStyleFamilies
458 rtl::Reference<ScStyleFamilyObj> ScStyleFamiliesObj::GetObjectByType_Impl(SfxStyleFamily nType) const
460 if ( pDocShell )
462 if ( nType == SfxStyleFamily::Para )
463 return new ScStyleFamilyObj( pDocShell, SfxStyleFamily::Para );
464 else if ( nType == SfxStyleFamily::Page )
465 return new ScStyleFamilyObj( pDocShell, SfxStyleFamily::Page );
466 else if ( nType == SfxStyleFamily::Frame )
467 return new ScStyleFamilyObj( pDocShell, SfxStyleFamily::Frame );
469 OSL_FAIL("getStyleFamilyByType: no DocShell or wrong SfxStyleFamily");
470 return nullptr;
473 rtl::Reference<ScStyleFamilyObj> ScStyleFamiliesObj::GetObjectByIndex_Impl(sal_uInt32 nIndex) const
475 if ( nIndex < SC_STYLE_FAMILY_COUNT )
476 return GetObjectByType_Impl(aStyleFamilyTypes[nIndex]);
478 return nullptr; // invalid index
481 rtl::Reference<ScStyleFamilyObj> ScStyleFamiliesObj::GetObjectByName_Impl(std::u16string_view aName) const
483 if ( pDocShell )
485 if ( aName == SC_FAMILYNAME_CELL )
486 return new ScStyleFamilyObj( pDocShell, SfxStyleFamily::Para );
487 else if ( aName == SC_FAMILYNAME_PAGE )
488 return new ScStyleFamilyObj( pDocShell, SfxStyleFamily::Page );
489 else if ( aName == SC_FAMILYNAME_GRAPHIC )
490 return new ScStyleFamilyObj( pDocShell, SfxStyleFamily::Frame );
492 // no assertion - called directly from getByName
493 return nullptr;
496 // container::XIndexAccess
498 sal_Int32 SAL_CALL ScStyleFamiliesObj::getCount()
500 return SC_STYLE_FAMILY_COUNT;
503 uno::Any SAL_CALL ScStyleFamiliesObj::getByIndex( sal_Int32 nIndex )
505 SolarMutexGuard aGuard;
506 uno::Reference< container::XNameContainer > xFamily(GetObjectByIndex_Impl(nIndex));
507 if (!xFamily.is())
508 throw lang::IndexOutOfBoundsException();
510 return uno::Any(xFamily);
513 uno::Type SAL_CALL ScStyleFamiliesObj::getElementType()
515 return cppu::UnoType<container::XNameContainer>::get(); // has to fit to getByIndex
518 sal_Bool SAL_CALL ScStyleFamiliesObj::hasElements()
520 SolarMutexGuard aGuard;
521 return ( getCount() != 0 );
524 // container::XNameAccess
526 uno::Any SAL_CALL ScStyleFamiliesObj::getByName( const OUString& aName )
528 SolarMutexGuard aGuard;
529 uno::Reference< container::XNameContainer > xFamily(GetObjectByName_Impl(aName));
530 if (!xFamily.is())
531 throw container::NoSuchElementException();
533 return uno::Any(xFamily);
536 uno::Sequence<OUString> SAL_CALL ScStyleFamiliesObj::getElementNames()
538 return {SC_FAMILYNAME_CELL, SC_FAMILYNAME_PAGE, SC_FAMILYNAME_GRAPHIC};
541 sal_Bool SAL_CALL ScStyleFamiliesObj::hasByName( const OUString& aName )
543 return aName == SC_FAMILYNAME_CELL || aName == SC_FAMILYNAME_PAGE || aName == SC_FAMILYNAME_GRAPHIC;
546 // style::XStyleLoader
548 void SAL_CALL ScStyleFamiliesObj::loadStylesFromURL( const OUString& aURL,
549 const uno::Sequence<beans::PropertyValue>& aOptions )
551 //! use aOptions (like Writer)
552 //! set flag to disable filter option dialogs when importing
554 OUString aFilter; // empty - detect
555 OUString aFiltOpt;
556 uno::Reference<io::XInputStream> xInputStream;
557 if (aURL == "private:stream")
559 for (const auto& rProp : aOptions)
561 if (rProp.Name == "InputStream")
563 rProp.Value >>= xInputStream;
564 if (!xInputStream.is())
566 throw lang::IllegalArgumentException(
567 u"Parameter 'InputStream' could not be converted "
568 "to type 'com::sun::star::io::XInputStream'"_ustr,
569 nullptr, 0);
571 break;
576 ScDocumentLoader aLoader( aURL, aFilter, aFiltOpt, 0, nullptr, xInputStream );
578 ScDocShell* pSource = aLoader.GetDocShell();
580 loadStylesFromDocShell(pSource, aOptions);
583 uno::Sequence<beans::PropertyValue> SAL_CALL ScStyleFamiliesObj::getStyleLoaderOptions()
585 // return defaults for options (?)
586 return comphelper::InitPropertySequence({
587 { SC_UNONAME_OVERWSTL, uno::Any(true) },
588 { SC_UNONAME_LOADCELL, uno::Any(true) },
589 { SC_UNONAME_LOADPAGE, uno::Any(true) }
593 // style::XStyleLoader2
595 void SAL_CALL ScStyleFamiliesObj::loadStylesFromDocument( const uno::Reference < lang::XComponent > & aSourceComponent,
596 const uno::Sequence<beans::PropertyValue>& aOptions )
598 // Source document docShell
599 if ( !aSourceComponent.is() )
600 throw uno::RuntimeException();
602 ScDocShell* pDocShellSrc = dynamic_cast<ScDocShell*> (SfxObjectShell::GetShellFromComponent(aSourceComponent));
604 loadStylesFromDocShell(pDocShellSrc, aOptions);
607 // private
609 void ScStyleFamiliesObj::loadStylesFromDocShell( ScDocShell* pSource,
610 const uno::Sequence<beans::PropertyValue>& aOptions )
613 if ( !(pSource && pDocShell) )
614 return;
616 // collect options
618 bool bLoadReplace = true; // defaults
619 bool bLoadCellStyles = true;
620 bool bLoadPageStyles = true;
622 for (const beans::PropertyValue& rProp : aOptions)
624 OUString aPropName(rProp.Name);
626 if (aPropName == SC_UNONAME_OVERWSTL)
627 bLoadReplace = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
628 else if (aPropName == SC_UNONAME_LOADCELL)
629 bLoadCellStyles = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
630 else if (aPropName == SC_UNONAME_LOADPAGE)
631 bLoadPageStyles = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value );
634 pDocShell->LoadStylesArgs( *pSource, bLoadReplace, bLoadCellStyles, bLoadPageStyles );
635 pDocShell->SetDocumentModified(); // paint is inside LoadStyles
638 ScStyleFamilyObj::ScStyleFamilyObj(ScDocShell* pDocSh, SfxStyleFamily eFam) :
639 pDocShell( pDocSh ),
640 eFamily( eFam )
642 pDocShell->GetDocument().AddUnoObject(*this);
645 ScStyleFamilyObj::~ScStyleFamilyObj()
647 SolarMutexGuard g;
649 if (pDocShell)
650 pDocShell->GetDocument().RemoveUnoObject(*this);
653 void ScStyleFamilyObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
655 // reference update does not matter here
657 if ( rHint.GetId() == SfxHintId::Dying )
659 pDocShell = nullptr; // has become invalid
663 // XStyleFamily
665 rtl::Reference<ScStyleObj> ScStyleFamilyObj::GetObjectByIndex_Impl(sal_Int32 nIndex)
667 if ( pDocShell )
669 ScDocument& rDoc = pDocShell->GetDocument();
670 ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
672 SfxStyleSheetIterator aIter( pStylePool, eFamily );
673 if ( nIndex < aIter.Count() )
675 SfxStyleSheetBase* pStyle = aIter[nIndex];
676 if ( pStyle )
678 return new ScStyleObj( pDocShell, eFamily, pStyle->GetName() );
682 return nullptr;
685 rtl::Reference<ScStyleObj> ScStyleFamilyObj::GetObjectByName_Impl(const OUString& aName)
687 if ( pDocShell )
689 ScDocument& rDoc = pDocShell->GetDocument();
690 ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
691 if ( pStylePool->Find( aName, eFamily ) )
692 return new ScStyleObj( pDocShell, eFamily, aName );
694 return nullptr;
697 void SAL_CALL ScStyleFamilyObj::insertByName( const OUString& aName, const uno::Any& aElement )
699 SolarMutexGuard aGuard;
700 bool bDone = false;
701 // reflection does not need to be uno::XInterface, can be any interface...
702 uno::Reference< uno::XInterface > xInterface(aElement, uno::UNO_QUERY);
703 if ( xInterface.is() )
705 ScStyleObj* pStyleObj = dynamic_cast<ScStyleObj*>( xInterface.get() );
706 if ( pStyleObj && pStyleObj->GetFamily() == eFamily &&
707 !pStyleObj->IsInserted() ) // not yet inserted?
709 OUString aNameStr(ScStyleNameConversion::ProgrammaticToDisplayName( aName, eFamily ));
711 ScDocument& rDoc = pDocShell->GetDocument();
712 ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
714 //! DocFunc function ???
715 //! Undo ?????????????
717 if ( pStylePool->Find( aNameStr, eFamily ) ) // not available yet
718 throw container::ElementExistException();
720 (void)pStylePool->Make( aNameStr, eFamily, SfxStyleSearchBits::UserDefined );
722 if ( eFamily == SfxStyleFamily::Para && !rDoc.IsImportingXML() )
723 rDoc.getCellAttributeHelper().CellStyleCreated(rDoc, aNameStr);
725 pStyleObj->InitDoc( pDocShell, aNameStr ); // object can be used
727 if (!rDoc.IsImportingXML())
728 pDocShell->SetDocumentModified(); // new style not used yet
729 bDone = true;
734 if (!bDone)
736 // other errors are handled above
737 throw lang::IllegalArgumentException();
741 void SAL_CALL ScStyleFamilyObj::replaceByName( const OUString& aName, const uno::Any& aElement )
743 SolarMutexGuard aGuard;
744 //! combine?
745 removeByName( aName );
746 insertByName( aName, aElement );
749 void SAL_CALL ScStyleFamilyObj::removeByName( const OUString& aName )
751 SolarMutexGuard aGuard;
752 bool bFound = false;
753 if ( pDocShell )
755 OUString aString(ScStyleNameConversion::ProgrammaticToDisplayName( aName, eFamily ));
757 ScDocument& rDoc = pDocShell->GetDocument();
758 ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
760 //! DocFunc function??
761 //! Undo ?????????????
763 SfxStyleSheetBase* pStyle = pStylePool->Find( aString, eFamily );
764 if (pStyle)
766 bFound = true;
767 if ( eFamily == SfxStyleFamily::Para )
769 // like ScViewFunc::RemoveStyleSheetInUse
770 ScopedVclPtrInstance< VirtualDevice > pVDev;
771 Point aLogic = pVDev->LogicToPixel(Point(1000,1000), MapMode(MapUnit::MapTwip));
772 double nPPTX = aLogic.X() / 1000.0;
773 double nPPTY = aLogic.Y() / 1000.0;
774 Fraction aZoom(1,1);
775 rDoc.StyleSheetChanged( pStyle, false, pVDev, nPPTX, nPPTY, aZoom, aZoom );
776 pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left );
777 pDocShell->SetDocumentModified();
779 pStylePool->Remove( pStyle );
781 //! InvalidateAttribs(); // Bindings-Invalidate
783 else if ( eFamily == SfxStyleFamily::Page )
785 if ( rDoc.RemovePageStyleInUse( aString ) )
786 pDocShell->PageStyleModified( ScResId(STR_STYLENAME_STANDARD), true );
788 pStylePool->Remove( pStyle );
790 SfxBindings* pBindings = pDocShell->GetViewBindings();
791 if (pBindings)
792 pBindings->Invalidate( SID_STYLE_FAMILY4 );
793 pDocShell->SetDocumentModified();
795 else
797 pStylePool->Remove( pStyle );
799 SfxBindings* pBindings = pDocShell->GetViewBindings();
800 if (pBindings)
801 pBindings->Invalidate( SID_STYLE_FAMILY3 );
802 pDocShell->SetDocumentModified();
807 if (!bFound)
808 throw container::NoSuchElementException();
811 // container::XIndexAccess
813 sal_Int32 SAL_CALL ScStyleFamilyObj::getCount()
815 SolarMutexGuard aGuard;
816 if ( pDocShell )
818 ScDocument& rDoc = pDocShell->GetDocument();
819 ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
821 SfxStyleSheetIterator aIter( pStylePool, eFamily );
822 return aIter.Count();
824 return 0;
827 uno::Any SAL_CALL ScStyleFamilyObj::getByIndex( sal_Int32 nIndex )
829 SolarMutexGuard aGuard;
830 uno::Reference< style::XStyle > xObj(GetObjectByIndex_Impl(nIndex));
831 if (!xObj.is())
832 throw lang::IndexOutOfBoundsException();
834 return uno::Any(xObj);
837 uno::Type SAL_CALL ScStyleFamilyObj::getElementType()
839 return cppu::UnoType<style::XStyle>::get(); // has to fit to getByIndex
842 sal_Bool SAL_CALL ScStyleFamilyObj::hasElements()
844 SolarMutexGuard aGuard;
845 return ( getCount() != 0 );
848 // container::XNameAccess
850 uno::Any SAL_CALL ScStyleFamilyObj::getByName( const OUString& aName )
852 SolarMutexGuard aGuard;
853 uno::Reference< style::XStyle > xObj(
854 GetObjectByName_Impl( ScStyleNameConversion::ProgrammaticToDisplayName( aName, eFamily ) ));
855 if (!xObj.is())
856 throw container::NoSuchElementException();
858 return uno::Any(xObj);
861 uno::Sequence<OUString> SAL_CALL ScStyleFamilyObj::getElementNames()
863 SolarMutexGuard aGuard;
864 if ( pDocShell )
866 ScDocument& rDoc = pDocShell->GetDocument();
867 ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
869 SfxStyleSheetIterator aIter( pStylePool, eFamily );
870 sal_uInt16 nCount = aIter.Count();
872 uno::Sequence<OUString> aSeq(nCount);
873 OUString* pAry = aSeq.getArray();
874 SfxStyleSheetBase* pStyle = aIter.First();
875 sal_uInt16 nPos = 0;
876 while (pStyle)
878 OSL_ENSURE( nPos < nCount, "Count is wrong" );
879 if (nPos < nCount)
880 pAry[nPos++] = ScStyleNameConversion::DisplayToProgrammaticName(
881 pStyle->GetName(), eFamily );
882 pStyle = aIter.Next();
884 return aSeq;
886 return uno::Sequence<OUString>();
889 sal_Bool SAL_CALL ScStyleFamilyObj::hasByName( const OUString& aName )
891 SolarMutexGuard aGuard;
892 if ( pDocShell )
894 OUString aString(ScStyleNameConversion::ProgrammaticToDisplayName( aName, eFamily ));
896 ScDocument& rDoc = pDocShell->GetDocument();
897 ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
898 if ( pStylePool->Find( aString, eFamily ) )
899 return true;
901 return false;
904 // XPropertySet
906 uno::Reference< beans::XPropertySetInfo > SAL_CALL ScStyleFamilyObj::getPropertySetInfo( )
908 OSL_FAIL( "###unexpected!" );
909 return uno::Reference< beans::XPropertySetInfo >();
912 void SAL_CALL ScStyleFamilyObj::setPropertyValue( const OUString&, const uno::Any& )
914 OSL_FAIL( "###unexpected!" );
917 uno::Any SAL_CALL ScStyleFamilyObj::getPropertyValue( const OUString& sPropertyName )
919 uno::Any aRet;
921 if ( sPropertyName != "DisplayName" )
923 throw beans::UnknownPropertyException( "unknown property: " + sPropertyName, getXWeak() );
926 SolarMutexGuard aGuard;
927 TranslateId pResId;
928 switch ( eFamily )
930 case SfxStyleFamily::Para:
931 pResId = STR_STYLE_FAMILY_CELL; break;
932 case SfxStyleFamily::Page:
933 pResId = STR_STYLE_FAMILY_PAGE; break;
934 case SfxStyleFamily::Frame:
935 pResId = STR_STYLE_FAMILY_GRAPHICS; break;
936 default:
937 OSL_FAIL( "ScStyleFamilyObj::getPropertyValue(): invalid family" );
939 if (pResId)
941 OUString sDisplayName(ScResId(pResId));
942 aRet <<= sDisplayName;
945 return aRet;
948 void SAL_CALL ScStyleFamilyObj::addPropertyChangeListener( const OUString&, const uno::Reference< beans::XPropertyChangeListener >& )
950 OSL_FAIL( "###unexpected!" );
953 void SAL_CALL ScStyleFamilyObj::removePropertyChangeListener( const OUString&, const uno::Reference< beans::XPropertyChangeListener >& )
955 OSL_FAIL( "###unexpected!" );
958 void SAL_CALL ScStyleFamilyObj::addVetoableChangeListener( const OUString&, const uno::Reference< beans::XVetoableChangeListener >& )
960 OSL_FAIL( "###unexpected!" );
963 void SAL_CALL ScStyleFamilyObj::removeVetoableChangeListener( const OUString&, const uno::Reference< beans::XVetoableChangeListener >& )
965 OSL_FAIL( "###unexpected!" );
968 // default ctor is needed for reflection
970 ScStyleObj::ScStyleObj(ScDocShell* pDocSh, SfxStyleFamily eFam, OUString aName)
971 : pDocShell(pDocSh)
972 , eFamily(eFam)
973 , aStyleName(std::move(aName))
974 , pStyle_cached(nullptr)
976 if (eFam == SfxStyleFamily::Para)
977 pPropSet = lcl_GetCellStyleSet();
978 else if (eFam == SfxStyleFamily::Page)
979 pPropSet = lcl_GetPageStyleSet();
980 else
981 pPropSet = lcl_GetGraphicStyleSet();
983 // if create by ServiceProvider then pDocShell is NULL
985 if (pDocShell)
986 pDocShell->GetDocument().AddUnoObject(*this);
989 void ScStyleObj::InitDoc( ScDocShell* pNewDocSh, const OUString& rNewName )
991 if ( pNewDocSh && !pDocShell )
993 aStyleName = rNewName;
994 pDocShell = pNewDocSh;
995 pDocShell->GetDocument().AddUnoObject(*this);
999 ScStyleObj::~ScStyleObj()
1001 SolarMutexGuard g;
1003 if (pDocShell)
1004 pDocShell->GetDocument().RemoveUnoObject(*this);
1007 void ScStyleObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
1009 // reference update does not matter here
1011 if ( rHint.GetId() == SfxHintId::Dying )
1013 pDocShell = nullptr; // has become invalid
1017 SfxStyleSheetBase* ScStyleObj::GetStyle_Impl( bool bUseCachedValue )
1019 if ( bUseCachedValue )
1020 return pStyle_cached;
1022 pStyle_cached = nullptr;
1023 if ( pDocShell )
1025 ScDocument& rDoc = pDocShell->GetDocument();
1026 ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
1027 pStyle_cached = pStylePool->Find( aStyleName, eFamily );
1029 return pStyle_cached;
1032 // style::XStyle
1034 sal_Bool SAL_CALL ScStyleObj::isUserDefined()
1036 SolarMutexGuard aGuard;
1037 SfxStyleSheetBase* pStyle = GetStyle_Impl();
1038 if (pStyle)
1039 return pStyle->IsUserDefined();
1040 return false;
1043 sal_Bool SAL_CALL ScStyleObj::isInUse()
1045 SolarMutexGuard aGuard;
1046 SfxStyleSheetBase* pStyle = GetStyle_Impl();
1047 if (pStyle)
1048 return pStyle->IsUsed();
1049 return false;
1052 OUString SAL_CALL ScStyleObj::getParentStyle()
1054 SolarMutexGuard aGuard;
1055 SfxStyleSheetBase* pStyle = GetStyle_Impl();
1056 if (pStyle)
1057 return ScStyleNameConversion::DisplayToProgrammaticName( pStyle->GetParent(), eFamily );
1058 return OUString();
1061 void SAL_CALL ScStyleObj::setParentStyle( const OUString& rParentStyle )
1063 SolarMutexGuard aGuard;
1064 SfxStyleSheetBase* pStyle = GetStyle_Impl();
1065 if (!pStyle)
1066 return;
1068 // cell styles cannot be modified if any sheet is protected
1069 if ( eFamily == SfxStyleFamily::Para && lcl_AnyTabProtected( pDocShell->GetDocument() ) )
1070 return; //! exception?
1072 //! DocFunc function??
1073 //! Undo ?????????????
1075 OUString aString(ScStyleNameConversion::ProgrammaticToDisplayName( rParentStyle, eFamily ));
1076 bool bOk = pStyle->SetParent( aString );
1077 if (!bOk)
1078 return;
1080 // as by setPropertyValue
1082 ScDocument& rDoc = pDocShell->GetDocument();
1083 if ( eFamily == SfxStyleFamily::Para )
1085 // update line height
1087 ScopedVclPtrInstance< VirtualDevice > pVDev;
1088 Point aLogic = pVDev->LogicToPixel( Point(1000,1000), MapMode(MapUnit::MapTwip));
1089 double nPPTX = aLogic.X() / 1000.0;
1090 double nPPTY = aLogic.Y() / 1000.0;
1091 Fraction aZoom(1,1);
1092 rDoc.StyleSheetChanged( pStyle, false, pVDev, nPPTX, nPPTY, aZoom, aZoom );
1094 if (!rDoc.IsImportingXML())
1096 pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left );
1097 pDocShell->SetDocumentModified();
1100 else if ( eFamily == SfxStyleFamily::Page )
1102 //! ModifyStyleSheet on document (save old values)
1104 pDocShell->PageStyleModified( aStyleName, true );
1106 else
1107 static_cast<SfxStyleSheet*>(GetStyle_Impl())->Broadcast(SfxHint(SfxHintId::DataChanged));
1110 // container::XNamed
1112 OUString SAL_CALL ScStyleObj::getName()
1114 SolarMutexGuard aGuard;
1115 SfxStyleSheetBase* pStyle = GetStyle_Impl();
1116 if (pStyle)
1117 return ScStyleNameConversion::DisplayToProgrammaticName( pStyle->GetName(), eFamily );
1118 return OUString();
1121 void SAL_CALL ScStyleObj::setName( const OUString& aNewName )
1123 SolarMutexGuard aGuard;
1124 SfxStyleSheetBase* pStyle = GetStyle_Impl();
1125 if (!pStyle)
1126 return;
1128 // cell styles cannot be renamed if any sheet is protected
1129 if ( eFamily == SfxStyleFamily::Para && lcl_AnyTabProtected( pDocShell->GetDocument() ) )
1130 return; //! exception?
1132 //! DocFunc function??
1133 //! Undo ?????????????
1135 bool bOk = pStyle->SetName( aNewName );
1136 if (!bOk)
1137 return;
1139 aStyleName = aNewName; //! notify other objects for this style?
1141 ScDocument& rDoc = pDocShell->GetDocument();
1142 if ( eFamily == SfxStyleFamily::Para && !rDoc.IsImportingXML() )
1143 rDoc.getCellAttributeHelper().CellStyleCreated(rDoc, aNewName);
1145 // cell styles = 2, drawing styles = 3, page styles = 4
1146 sal_uInt16 nId = eFamily == SfxStyleFamily::Para ? SID_STYLE_FAMILY2 :
1147 (eFamily == SfxStyleFamily::Page ? SID_STYLE_FAMILY4 : SID_STYLE_FAMILY3);
1148 SfxBindings* pBindings = pDocShell->GetViewBindings();
1149 if (pBindings)
1151 pBindings->Invalidate( nId );
1152 pBindings->Invalidate( SID_STYLE_APPLY );
1156 uno::Reference<container::XIndexReplace> ScStyleObj::CreateEmptyNumberingRules()
1158 SvxNumRule aRule( SvxNumRuleFlags::NONE, 0, true ); // nothing supported
1159 return SvxCreateNumRule( aRule );
1162 // beans::XPropertyState
1164 const SfxItemSet* ScStyleObj::GetStyleItemSet_Impl( const OUString& rPropName,
1165 const SfxItemPropertyMapEntry*& rpResultEntry )
1167 SfxStyleSheetBase* pStyle = GetStyle_Impl( true );
1168 if ( pStyle )
1170 const SfxItemPropertyMapEntry* pEntry = nullptr;
1171 if ( eFamily == SfxStyleFamily::Page )
1173 pEntry = lcl_GetHeaderStyleMap()->getByName( rPropName );
1174 if ( pEntry ) // only item-WIDs in header/footer map
1176 rpResultEntry = pEntry;
1177 return &pStyle->GetItemSet().Get(ATTR_PAGE_HEADERSET).GetItemSet();
1179 pEntry = lcl_GetFooterStyleMap()->getByName( rPropName );
1180 if ( pEntry ) // only item-WIDs in header/footer map
1182 rpResultEntry = pEntry;
1183 return &pStyle->GetItemSet().Get(ATTR_PAGE_FOOTERSET).GetItemSet();
1186 pEntry = pPropSet->getPropertyMap().getByName( rPropName );
1187 if ( pEntry )
1189 rpResultEntry = pEntry;
1190 return &pStyle->GetItemSet();
1194 rpResultEntry = nullptr;
1195 return nullptr;
1198 beans::PropertyState ScStyleObj::getPropertyState_Impl( const OUString& aPropertyName )
1200 beans::PropertyState eRet = beans::PropertyState_DIRECT_VALUE;
1202 const SfxItemPropertyMapEntry* pResultEntry = nullptr;
1203 const SfxItemSet* pItemSet = GetStyleItemSet_Impl( aPropertyName, pResultEntry );
1205 if ( pItemSet && pResultEntry )
1207 sal_uInt16 nWhich = pResultEntry->nWID;
1208 if ( nWhich == SC_WID_UNO_TBLBORD || nWhich == SC_WID_UNO_TBLBORD2 )
1210 nWhich = ATTR_BORDER;
1212 if ( nWhich == OWN_ATTR_FILLBMP_MODE )
1214 if ( pItemSet->GetItemState( XATTR_FILLBMP_STRETCH, false ) == SfxItemState::SET ||
1215 pItemSet->GetItemState( XATTR_FILLBMP_TILE, false ) == SfxItemState::SET )
1217 eRet = beans::PropertyState_DIRECT_VALUE;
1219 else
1221 eRet = beans::PropertyState_AMBIGUOUS_VALUE;
1224 else if ( nWhich == SDRATTR_TEXTDIRECTION )
1226 eRet = beans::PropertyState_DEFAULT_VALUE;
1228 else if ( IsScItemWid( nWhich ) || eFamily == SfxStyleFamily::Frame )
1230 SfxItemState eState = pItemSet->GetItemState( nWhich, false );
1232 // // if no rotate value is set, look at orientation
1233 // //! also for a fixed value of 0 (in case orientation is ambiguous)?
1234 // if ( nWhich == ATTR_ROTATE_VALUE && eState == SfxItemState::DEFAULT )
1235 // eState = pItemSet->GetItemState( ATTR_ORIENTATION, sal_False );
1237 if ( eState == SfxItemState::SET )
1238 eRet = beans::PropertyState_DIRECT_VALUE;
1239 else if ( eState == SfxItemState::DEFAULT )
1240 eRet = beans::PropertyState_DEFAULT_VALUE;
1241 else
1243 assert(eFamily == SfxStyleFamily::Frame);
1244 eRet = beans::PropertyState_AMBIGUOUS_VALUE;
1248 return eRet;
1251 beans::PropertyState SAL_CALL ScStyleObj::getPropertyState( const OUString& aPropertyName )
1253 SolarMutexGuard aGuard;
1254 GetStyle_Impl();
1256 return getPropertyState_Impl( aPropertyName );
1259 uno::Sequence<beans::PropertyState> SAL_CALL ScStyleObj::getPropertyStates( const uno::Sequence<OUString>& aPropertyNames )
1261 SolarMutexGuard aGuard;
1262 GetStyle_Impl();
1264 uno::Sequence<beans::PropertyState> aRet( aPropertyNames.getLength() );
1265 std::transform(aPropertyNames.begin(), aPropertyNames.end(), aRet.getArray(),
1266 [this](const OUString& rName) -> beans::PropertyState { return getPropertyState_Impl(rName); });
1267 return aRet;
1270 void SAL_CALL ScStyleObj::setPropertyToDefault( const OUString& aPropertyName )
1272 SolarMutexGuard aGuard;
1273 GetStyle_Impl();
1275 const SfxItemPropertyMapEntry* pEntry = pPropSet->getPropertyMap().getByName( aPropertyName );
1276 if ( !pEntry )
1277 throw beans::UnknownPropertyException(aPropertyName);
1279 setPropertyValue_Impl( aPropertyName, pEntry, nullptr );
1282 uno::Any ScStyleObj::getPropertyDefault_Impl( const OUString& aPropertyName )
1284 uno::Any aAny;
1286 const SfxItemPropertyMapEntry* pResultEntry = nullptr;
1287 const SfxItemSet* pStyleSet = GetStyleItemSet_Impl( aPropertyName, pResultEntry );
1289 if ( pStyleSet && pResultEntry )
1291 sal_uInt16 nWhich = pResultEntry->nWID;
1293 if ( IsScItemWid( nWhich ) )
1295 // Default is default from ItemPool, not from Standard-Style,
1296 // so it is the same as in setPropertyToDefault
1297 SfxItemSet aEmptySet( *pStyleSet->GetPool(), pStyleSet->GetRanges() );
1298 // default items with wrong Slot-ID are not functional in SfxItemPropertySet3
1299 //! change Slot-IDs...
1300 if ( aEmptySet.GetPool()->GetSlotId(nWhich) == nWhich &&
1301 aEmptySet.GetItemState(nWhich, false) == SfxItemState::DEFAULT )
1303 aEmptySet.Put( aEmptySet.Get( nWhich ) );
1305 const SfxItemSet* pItemSet = &aEmptySet;
1307 switch ( nWhich ) // special item handling
1309 case ATTR_VALUE_FORMAT:
1310 // default has no language set
1311 aAny <<= sal_Int32( static_cast<const SfxUInt32Item&>(pItemSet->Get(nWhich)).GetValue() );
1312 break;
1313 case ATTR_INDENT:
1314 aAny <<= sal_Int16( convertTwipToMm100(static_cast<const ScIndentItem&>(
1315 pItemSet->Get(nWhich)).GetValue()) );
1316 break;
1317 case ATTR_PAGE_SCALE:
1318 case ATTR_PAGE_SCALETOPAGES:
1319 case ATTR_PAGE_FIRSTPAGENO:
1320 aAny <<= sal_Int16( static_cast<const SfxUInt16Item&>(pItemSet->Get(nWhich)).GetValue() );
1321 break;
1322 case ATTR_PAGE_CHARTS:
1323 case ATTR_PAGE_OBJECTS:
1324 case ATTR_PAGE_DRAWINGS:
1325 //! define sal_Bool-MID for ScViewObjectModeItem?
1326 aAny <<= static_cast<const ScViewObjectModeItem&>(pItemSet->Get(nWhich)).GetValue() == VOBJ_MODE_SHOW;
1327 break;
1328 case ATTR_PAGE_SCALETO:
1330 const ScPageScaleToItem aItem(static_cast<const ScPageScaleToItem&>(pItemSet->Get(nWhich)));
1331 if ( aPropertyName == SC_UNO_PAGE_SCALETOX )
1332 aAny <<= static_cast<sal_Int16>(aItem.GetWidth());
1333 else
1334 aAny <<= static_cast<sal_Int16>(aItem.GetHeight());
1336 break;
1337 default:
1338 SfxItemPropertySet::getPropertyValue( *pResultEntry, *pItemSet, aAny );
1341 else if ( IsScUnoWid( nWhich ) )
1343 SfxItemSet aEmptySet( *pStyleSet->GetPool(), pStyleSet->GetRanges() );
1344 const SfxItemSet* pItemSet = &aEmptySet;
1345 switch ( nWhich )
1347 case SC_WID_UNO_TBLBORD:
1348 case SC_WID_UNO_TBLBORD2:
1350 const SfxPoolItem& rItem = pItemSet->Get(ATTR_BORDER);
1351 SvxBoxItem aOuter(static_cast<const SvxBoxItem&>(rItem));
1352 SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
1353 if (nWhich == SC_WID_UNO_TBLBORD2)
1354 ScHelperFunctions::AssignTableBorder2ToAny(aAny, aOuter, aInner, true);
1355 else
1356 ScHelperFunctions::AssignTableBorderToAny(aAny, aOuter, aInner, true);
1358 break;
1361 else if ( nWhich == SDRATTR_TEXTDIRECTION )
1363 aAny <<= false;
1365 else if ( nWhich == OWN_ATTR_FILLBMP_MODE )
1367 aAny <<= css::drawing::BitmapMode_REPEAT;
1369 else if ( nWhich != OWN_ATTR_TEXTCOLUMNS )
1371 SfxItemSet aItemSet(*pStyleSet->GetPool(), pStyleSet->GetRanges());
1372 aAny = SvxItemPropertySet_getPropertyValue(pResultEntry, aItemSet);
1375 return aAny;
1378 uno::Any SAL_CALL ScStyleObj::getPropertyDefault( const OUString& aPropertyName )
1380 SolarMutexGuard aGuard;
1381 GetStyle_Impl();
1383 return getPropertyDefault_Impl( aPropertyName );
1386 uno::Sequence<uno::Any> SAL_CALL ScStyleObj::getPropertyDefaults( const uno::Sequence<OUString>& aPropertyNames )
1388 SolarMutexGuard aGuard;
1389 GetStyle_Impl();
1391 uno::Sequence<uno::Any> aSequence( aPropertyNames.getLength() );
1392 std::transform(aPropertyNames.begin(), aPropertyNames.end(), aSequence.getArray(),
1393 [this](const OUString& rName) -> uno::Any { return getPropertyDefault_Impl(rName); });
1394 return aSequence;
1397 // XMultiPropertySet
1399 void SAL_CALL ScStyleObj::setPropertyValues( const uno::Sequence< OUString >& aPropertyNames,
1400 const uno::Sequence< uno::Any >& aValues )
1402 SolarMutexGuard aGuard;
1403 GetStyle_Impl();
1405 if ( aValues.getLength() != aPropertyNames.getLength() )
1406 throw lang::IllegalArgumentException();
1408 const OUString* pNames = aPropertyNames.getConstArray();
1409 const uno::Any* pValues = aValues.getConstArray();
1410 const SfxItemPropertyMap& rPropertyMap = pPropSet->getPropertyMap();
1411 for ( sal_Int32 i = 0; i < aPropertyNames.getLength(); i++ )
1413 const SfxItemPropertyMapEntry* pEntry = rPropertyMap.getByName( pNames[i] );
1414 setPropertyValue_Impl( pNames[i], pEntry, &pValues[i] );
1418 uno::Sequence<uno::Any> SAL_CALL ScStyleObj::getPropertyValues( const uno::Sequence< OUString >& aPropertyNames )
1420 SolarMutexGuard aGuard;
1421 GetStyle_Impl();
1423 uno::Sequence<uno::Any> aSequence( aPropertyNames.getLength() );
1424 std::transform(aPropertyNames.begin(), aPropertyNames.end(), aSequence.getArray(),
1425 [this](const OUString& rName) -> uno::Any { return getPropertyValue_Impl(rName); });
1426 return aSequence;
1429 void SAL_CALL ScStyleObj::addPropertiesChangeListener( const uno::Sequence<OUString>& /* aPropertyNames */,
1430 const uno::Reference<beans::XPropertiesChangeListener>& /* xListener */ )
1432 // no bound properties
1435 void SAL_CALL ScStyleObj::removePropertiesChangeListener(
1436 const uno::Reference<beans::XPropertiesChangeListener>& /* xListener */ )
1438 // no bound properties
1441 void SAL_CALL ScStyleObj::firePropertiesChangeEvent( const uno::Sequence<OUString>& /* aPropertyNames */,
1442 const uno::Reference<beans::XPropertiesChangeListener>& /* xListener */ )
1444 // no bound properties
1447 // XMultiPropertyStates
1448 // getPropertyStates already defined for XPropertyState
1450 void SAL_CALL ScStyleObj::setAllPropertiesToDefault()
1452 SolarMutexGuard aGuard;
1454 SfxStyleSheetBase* pStyle = GetStyle_Impl();
1455 if ( !pStyle )
1456 return;
1458 // cell styles cannot be modified if any sheet is protected
1459 if ( eFamily == SfxStyleFamily::Para && lcl_AnyTabProtected( pDocShell->GetDocument() ) )
1460 throw uno::RuntimeException();
1462 SfxItemSet& rSet = pStyle->GetItemSet();
1463 rSet.ClearItem(); // set all items to default
1465 //! merge with SetOneProperty
1467 ScDocument& rDoc = pDocShell->GetDocument();
1468 if ( eFamily == SfxStyleFamily::Para )
1470 // row heights
1472 ScopedVclPtrInstance< VirtualDevice > pVDev;
1473 Point aLogic = pVDev->LogicToPixel(Point(1000,1000), MapMode(MapUnit::MapTwip));
1474 double nPPTX = aLogic.X() / 1000.0;
1475 double nPPTY = aLogic.Y() / 1000.0;
1476 Fraction aZoom(1,1);
1477 rDoc.StyleSheetChanged( pStyle, false, pVDev, nPPTX, nPPTY, aZoom, aZoom );
1479 if (!rDoc.IsImportingXML())
1481 pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left );
1482 pDocShell->SetDocumentModified();
1485 else if ( eFamily == SfxStyleFamily::Page )
1487 // #i22448# apply the default BoxInfoItem for page styles again
1488 // (same content as in ScStyleSheet::GetItemSet, to control the dialog)
1489 SvxBoxInfoItem aBoxInfoItem( ATTR_BORDER_INNER );
1490 aBoxInfoItem.SetTable( false );
1491 aBoxInfoItem.SetDist( true );
1492 aBoxInfoItem.SetValid( SvxBoxInfoItemValidFlags::DISTANCE );
1493 rSet.Put( aBoxInfoItem );
1495 pDocShell->PageStyleModified( aStyleName, true );
1497 else
1498 static_cast<SfxStyleSheet*>(GetStyle_Impl())->Broadcast(SfxHint(SfxHintId::DataChanged));
1501 void SAL_CALL ScStyleObj::setPropertiesToDefault( const uno::Sequence<OUString>& aPropertyNames )
1503 SolarMutexGuard aGuard;
1504 GetStyle_Impl();
1506 const SfxItemPropertyMap& rPropertyMap = pPropSet->getPropertyMap();
1507 for ( const OUString& rName : aPropertyNames )
1509 const SfxItemPropertyMapEntry* pEntry = rPropertyMap.getByName( rName );
1510 setPropertyValue_Impl( rName, pEntry, nullptr );
1514 // beans::XPropertySet
1516 uno::Reference<beans::XPropertySetInfo> SAL_CALL ScStyleObj::getPropertySetInfo()
1518 SolarMutexGuard aGuard;
1519 return pPropSet->getPropertySetInfo();
1522 void SAL_CALL ScStyleObj::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
1524 SolarMutexGuard aGuard;
1525 GetStyle_Impl();
1527 const SfxItemPropertyMapEntry* pEntry = pPropSet->getPropertyMap().getByName( aPropertyName );
1528 if ( !pEntry )
1529 throw beans::UnknownPropertyException(aPropertyName);
1531 setPropertyValue_Impl( aPropertyName, pEntry, &aValue );
1534 void ScStyleObj::setPropertyValue_Impl( const OUString& rPropertyName, const SfxItemPropertyMapEntry* pEntry, const uno::Any* pValue )
1536 SfxStyleSheetBase* pStyle = GetStyle_Impl( true );
1537 if ( !(pStyle && pEntry) )
1538 return;
1540 // cell styles cannot be modified if any sheet is protected
1541 if ( eFamily == SfxStyleFamily::Para && lcl_AnyTabProtected( pDocShell->GetDocument() ) )
1542 throw uno::RuntimeException();
1544 SfxItemSet& rSet = pStyle->GetItemSet(); // change directly in active Style
1545 bool bDone = false;
1546 if ( eFamily == SfxStyleFamily::Page )
1548 if(pEntry->nWID == SC_WID_UNO_HEADERSET)
1550 const SfxItemPropertyMapEntry* pHeaderEntry = lcl_GetHeaderStyleMap()->getByName( rPropertyName );
1551 if ( pHeaderEntry ) // only item-WIDs in header/footer map
1553 SvxSetItem aNewHeader( rSet.Get(ATTR_PAGE_HEADERSET) );
1554 if (pValue)
1555 SfxItemPropertySet::setPropertyValue( *pHeaderEntry, *pValue, aNewHeader.GetItemSet() );
1556 else
1557 aNewHeader.GetItemSet().ClearItem( pHeaderEntry->nWID );
1558 rSet.Put( aNewHeader );
1559 bDone = true;
1562 else if(pEntry->nWID == SC_WID_UNO_FOOTERSET)
1564 const SfxItemPropertyMapEntry* pFooterEntry = lcl_GetFooterStyleMap()->getByName( rPropertyName );
1565 if ( pFooterEntry ) // only item-WIDs in header/footer map
1567 SvxSetItem aNewFooter( rSet.Get(ATTR_PAGE_FOOTERSET) );
1568 if (pValue)
1569 SfxItemPropertySet::setPropertyValue( *pFooterEntry, *pValue, aNewFooter.GetItemSet() );
1570 else
1571 aNewFooter.GetItemSet().ClearItem( pFooterEntry->nWID );
1572 rSet.Put( aNewFooter );
1573 bDone = true;
1577 if (!bDone)
1579 if (IsScItemWid(pEntry->nWID))
1581 if (pValue)
1583 switch (pEntry->nWID) // special item handling
1585 case ATTR_VALUE_FORMAT:
1587 // language for number formats
1588 SvNumberFormatter* pFormatter
1589 = pDocShell->GetDocument().GetFormatTable();
1590 sal_uInt32 nOldFormat = rSet.Get(ATTR_VALUE_FORMAT).GetValue();
1591 LanguageType eOldLang
1592 = rSet.Get(ATTR_LANGUAGE_FORMAT).GetLanguage();
1593 pFormatter->GetFormatForLanguageIfBuiltIn(nOldFormat, eOldLang);
1595 sal_uInt32 nNewFormat = 0;
1596 *pValue >>= nNewFormat;
1597 rSet.Put(SfxUInt32Item(ATTR_VALUE_FORMAT, nNewFormat));
1599 const SvNumberformat* pNewEntry = pFormatter->GetEntry(nNewFormat);
1600 LanguageType eNewLang
1601 = pNewEntry ? pNewEntry->GetLanguage() : LANGUAGE_DONTKNOW;
1602 if (eNewLang != eOldLang && eNewLang != LANGUAGE_DONTKNOW)
1603 rSet.Put(SvxLanguageItem(eNewLang, ATTR_LANGUAGE_FORMAT));
1605 //! keep default state of number format if only language changed?
1607 break;
1608 case ATTR_INDENT:
1610 sal_Int16 nVal = 0;
1611 *pValue >>= nVal;
1612 rSet.Put(ScIndentItem(o3tl::toTwips(nVal, o3tl::Length::mm100)));
1614 break;
1615 case ATTR_ROTATE_VALUE:
1617 sal_Int32 nRotVal = 0;
1618 if (*pValue >>= nRotVal)
1620 // stored value is always between 0 and 360 deg.
1621 nRotVal %= 36000;
1622 if (nRotVal < 0)
1623 nRotVal += 36000;
1624 rSet.Put(ScRotateValueItem(Degree100(nRotVal)));
1627 break;
1628 case ATTR_STACKED:
1630 table::CellOrientation eOrient;
1631 if (*pValue >>= eOrient)
1633 switch (eOrient)
1635 case table::CellOrientation_STANDARD:
1636 rSet.Put(ScVerticalStackCell(false));
1637 break;
1638 case table::CellOrientation_TOPBOTTOM:
1639 rSet.Put(ScVerticalStackCell(false));
1640 rSet.Put(ScRotateValueItem(27000_deg100));
1641 break;
1642 case table::CellOrientation_BOTTOMTOP:
1643 rSet.Put(ScVerticalStackCell(false));
1644 rSet.Put(ScRotateValueItem(9000_deg100));
1645 break;
1646 case table::CellOrientation_STACKED:
1647 rSet.Put(ScVerticalStackCell(true));
1648 break;
1649 default:
1651 // added to avoid warnings
1656 break;
1657 case ATTR_PAGE_SCALE:
1658 case ATTR_PAGE_SCALETOPAGES:
1660 rSet.ClearItem(ATTR_PAGE_SCALETOPAGES);
1661 rSet.ClearItem(ATTR_PAGE_SCALE);
1662 rSet.ClearItem(ATTR_PAGE_SCALETO);
1663 sal_Int16 nVal = 0;
1664 *pValue >>= nVal;
1665 rSet.Put(SfxUInt16Item(pEntry->nWID, nVal));
1667 break;
1668 case ATTR_PAGE_FIRSTPAGENO:
1670 sal_Int16 nVal = 0;
1671 *pValue >>= nVal;
1672 rSet.Put(SfxUInt16Item(ATTR_PAGE_FIRSTPAGENO, nVal));
1674 break;
1675 case ATTR_PAGE_CHARTS:
1676 case ATTR_PAGE_OBJECTS:
1677 case ATTR_PAGE_DRAWINGS:
1679 bool bBool = false;
1680 *pValue >>= bBool;
1681 //! need to define sal_Bool-MID for ScViewObjectModeItem?
1682 rSet.Put(ScViewObjectModeItem(
1683 pEntry->nWID, bBool ? VOBJ_MODE_SHOW : VOBJ_MODE_HIDE));
1685 break;
1686 case ATTR_PAGE_PAPERBIN:
1688 sal_uInt8 nTray = PAPERBIN_PRINTER_SETTINGS;
1689 bool bFound = false;
1691 OUString aName;
1692 if (*pValue >>= aName)
1694 if (aName == SC_PAPERBIN_DEFAULTNAME)
1695 bFound = true;
1696 else
1698 Printer* pPrinter = pDocShell->GetPrinter();
1699 if (pPrinter)
1701 const sal_uInt16 nCount = pPrinter->GetPaperBinCount();
1702 for (sal_uInt16 i = 0; i < nCount; i++)
1703 if (aName == pPrinter->GetPaperBinName(i))
1705 nTray = static_cast<sal_uInt8>(i);
1706 bFound = true;
1707 break;
1712 if (!bFound)
1713 throw lang::IllegalArgumentException();
1715 rSet.Put(SvxPaperBinItem(ATTR_PAGE_PAPERBIN, nTray));
1718 break;
1719 case ATTR_PAGE_SCALETO:
1721 sal_Int16 nPages = 0;
1722 if (*pValue >>= nPages)
1724 ScPageScaleToItem aItem = rSet.Get(ATTR_PAGE_SCALETO);
1725 if (rPropertyName == SC_UNO_PAGE_SCALETOX)
1726 aItem.SetWidth(static_cast<sal_uInt16>(nPages));
1727 else
1728 aItem.SetHeight(static_cast<sal_uInt16>(nPages));
1729 rSet.Put(aItem);
1730 rSet.ClearItem(ATTR_PAGE_SCALETOPAGES);
1731 rSet.ClearItem(ATTR_PAGE_SCALE);
1734 break;
1735 case ATTR_HIDDEN:
1737 bool bHidden = false;
1738 if (*pValue >>= bHidden)
1739 pStyle->SetHidden(bHidden);
1741 break;
1742 default:
1743 // default items with wrong Slot-ID are not working in SfxItemPropertySet3
1744 //! change Slot-IDs...
1745 if (rSet.GetPool()->GetSlotId(pEntry->nWID) == pEntry->nWID
1746 && rSet.GetItemState(pEntry->nWID, false) == SfxItemState::DEFAULT)
1748 rSet.Put(rSet.Get(pEntry->nWID));
1750 SfxItemPropertySet::setPropertyValue(*pEntry, *pValue, rSet);
1753 else
1755 rSet.ClearItem(pEntry->nWID);
1756 // language for number formats
1757 if (pEntry->nWID == ATTR_VALUE_FORMAT)
1758 rSet.ClearItem(ATTR_LANGUAGE_FORMAT);
1760 //! for ATTR_ROTATE_VALUE, also reset ATTR_ORIENTATION?
1763 else if (IsScUnoWid(pEntry->nWID))
1765 switch (pEntry->nWID)
1767 case SC_WID_UNO_TBLBORD:
1769 if (pValue)
1771 table::TableBorder aBorder;
1772 if (*pValue >>= aBorder)
1774 SvxBoxItem aOuter(ATTR_BORDER);
1775 SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
1776 ScHelperFunctions::FillBoxItems(aOuter, aInner, aBorder);
1777 rSet.Put(aOuter);
1780 else
1782 rSet.ClearItem(ATTR_BORDER);
1785 break;
1786 case SC_WID_UNO_TBLBORD2:
1788 if (pValue)
1790 table::TableBorder2 aBorder2;
1791 if (*pValue >>= aBorder2)
1793 SvxBoxItem aOuter(ATTR_BORDER);
1794 SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
1795 ScHelperFunctions::FillBoxItems(aOuter, aInner, aBorder2);
1796 rSet.Put(aOuter);
1799 else
1801 rSet.ClearItem(ATTR_BORDER);
1804 break;
1807 else if (pEntry->nWID == OWN_ATTR_FILLBMP_MODE)
1809 css::drawing::BitmapMode eMode;
1810 if (!pValue)
1812 rSet.ClearItem(XATTR_FILLBMP_STRETCH);
1813 rSet.ClearItem(XATTR_FILLBMP_TILE);
1815 else if (*pValue >>= eMode)
1817 rSet.Put(XFillBmpStretchItem(eMode == css::drawing::BitmapMode_STRETCH));
1818 rSet.Put(XFillBmpTileItem(eMode == css::drawing::BitmapMode_REPEAT));
1821 else if(pEntry->nMemberId == MID_NAME &&
1822 (pEntry->nWID == XATTR_FILLBITMAP || pEntry->nWID == XATTR_FILLGRADIENT ||
1823 pEntry->nWID == XATTR_FILLHATCH || pEntry->nWID == XATTR_FILLFLOATTRANSPARENCE ||
1824 pEntry->nWID == XATTR_LINESTART || pEntry->nWID == XATTR_LINEEND || pEntry->nWID == XATTR_LINEDASH))
1826 OUString aTempName;
1827 if (*pValue >>= aTempName)
1828 SvxShape::SetFillAttribute(pEntry->nWID, aTempName, rSet);
1830 else if(pEntry->nWID == SDRATTR_TEXTDIRECTION)
1832 return; // not yet implemented for styles
1834 else if(!SvxUnoTextRangeBase::SetPropertyValueHelper(pEntry, *pValue, rSet))
1836 SvxItemPropertySet_setPropertyValue(pEntry, *pValue, rSet);
1840 //! DocFunc-??
1841 //! Undo ??
1843 if ( eFamily == SfxStyleFamily::Para )
1845 // If we are loading, we can delay line height calculation, because we are going to re-calc all of those
1846 // after load.
1847 if (pDocShell && !pDocShell->IsLoading())
1849 // update line height
1850 ScopedVclPtrInstance< VirtualDevice > pVDev;
1851 Point aLogic = pVDev->LogicToPixel(Point(1000,1000), MapMode(MapUnit::MapTwip));
1852 double nPPTX = aLogic.X() / 1000.0;
1853 double nPPTY = aLogic.Y() / 1000.0;
1854 Fraction aZoom(1,1);
1855 ScDocument& rDoc = pDocShell->GetDocument();
1856 rDoc.StyleSheetChanged( pStyle, false, pVDev, nPPTX, nPPTY, aZoom, aZoom );
1858 if (!rDoc.IsImportingXML())
1860 pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left );
1861 pDocShell->SetDocumentModified();
1865 else if ( eFamily == SfxStyleFamily::Page )
1867 //! ModifyStyleSheet on document (save old values)
1869 pDocShell->PageStyleModified( aStyleName, true );
1871 else
1872 static_cast<SfxStyleSheet*>(GetStyle_Impl())->Broadcast(SfxHint(SfxHintId::DataChanged));
1875 uno::Any ScStyleObj::getPropertyValue_Impl( const OUString& aPropertyName )
1877 uno::Any aAny;
1878 SfxStyleSheetBase* pStyle = GetStyle_Impl( true );
1880 if ( aPropertyName == SC_UNONAME_DISPNAME ) // read-only
1882 // core always has the display name
1883 if ( pStyle )
1884 aAny <<= pStyle->GetName();
1886 else
1888 const SfxItemPropertyMapEntry* pResultEntry = nullptr;
1889 const SfxItemSet* pItemSet = GetStyleItemSet_Impl( aPropertyName, pResultEntry );
1891 if ( pItemSet && pResultEntry )
1893 sal_uInt16 nWhich = pResultEntry->nWID;
1895 if ( IsScItemWid( nWhich ) )
1897 switch ( nWhich ) // for special item handling
1899 case ATTR_VALUE_FORMAT:
1900 if ( pDocShell )
1902 sal_uInt32 nOldFormat =
1903 pItemSet->Get( ATTR_VALUE_FORMAT ).GetValue();
1904 LanguageType eOldLang =
1905 pItemSet->Get( ATTR_LANGUAGE_FORMAT ).GetLanguage();
1906 nOldFormat = pDocShell->GetDocument().GetFormatTable()->
1907 GetFormatForLanguageIfBuiltIn( nOldFormat, eOldLang );
1908 aAny <<= nOldFormat;
1910 break;
1911 case ATTR_INDENT:
1912 aAny <<= sal_Int16( convertTwipToMm100(static_cast<const ScIndentItem&>(
1913 pItemSet->Get(nWhich)).GetValue()) );
1914 break;
1915 case ATTR_STACKED:
1917 Degree100 nRot = pItemSet->Get(ATTR_ROTATE_VALUE).GetValue();
1918 bool bStacked = static_cast<const ScVerticalStackCell&>(pItemSet->Get(nWhich)).GetValue();
1919 SvxOrientationItem( nRot, bStacked, TypedWhichId<SvxOrientationItem>(0) ).QueryValue( aAny );
1921 break;
1922 case ATTR_PAGE_SCALE:
1923 case ATTR_PAGE_SCALETOPAGES:
1924 case ATTR_PAGE_FIRSTPAGENO:
1925 aAny <<= sal_Int16( static_cast<const SfxUInt16Item&>(pItemSet->Get(nWhich)).GetValue() );
1926 break;
1927 case ATTR_PAGE_CHARTS:
1928 case ATTR_PAGE_OBJECTS:
1929 case ATTR_PAGE_DRAWINGS:
1930 //! define sal_Bool-MID for ScViewObjectModeItem?
1931 aAny <<= static_cast<const ScViewObjectModeItem&>(pItemSet->Get(nWhich)).GetValue() == VOBJ_MODE_SHOW;
1932 break;
1933 case ATTR_PAGE_PAPERBIN:
1935 // property PrinterPaperTray is the name of the tray
1937 sal_uInt8 nValue = static_cast<const SvxPaperBinItem&>(pItemSet->Get(nWhich)).GetValue();
1938 OUString aName;
1939 if ( nValue == PAPERBIN_PRINTER_SETTINGS )
1940 aName = SC_PAPERBIN_DEFAULTNAME;
1941 else
1943 Printer* pPrinter = pDocShell->GetPrinter();
1944 if (pPrinter)
1945 aName = pPrinter->GetPaperBinName( nValue );
1947 aAny <<= aName;
1949 break;
1950 case ATTR_PAGE_SCALETO:
1952 const ScPageScaleToItem& aItem(pItemSet->Get(ATTR_PAGE_SCALETO));
1953 if ( aPropertyName == SC_UNO_PAGE_SCALETOX )
1954 aAny <<= static_cast<sal_Int16>(aItem.GetWidth());
1955 else
1956 aAny <<= static_cast<sal_Int16>(aItem.GetHeight());
1958 break;
1959 case ATTR_HIDDEN:
1961 bool bHidden = pStyle && pStyle->IsHidden();
1962 aAny <<= bHidden;
1964 break;
1965 default:
1966 // Default-Items with wrong Slot-ID don't work in SfxItemPropertySet3
1967 //! change Slot-IDs...
1968 if ( pItemSet->GetPool()->GetSlotId(nWhich) == nWhich &&
1969 pItemSet->GetItemState(nWhich, false) == SfxItemState::DEFAULT )
1971 SfxItemSet aNoEmptySet( *pItemSet );
1972 aNoEmptySet.Put( aNoEmptySet.Get( nWhich ) );
1973 SfxItemPropertySet::getPropertyValue( *pResultEntry, aNoEmptySet, aAny );
1975 else
1976 SfxItemPropertySet::getPropertyValue( *pResultEntry, *pItemSet, aAny );
1979 else if ( IsScUnoWid( nWhich ) )
1981 switch ( nWhich )
1983 case SC_WID_UNO_TBLBORD:
1984 case SC_WID_UNO_TBLBORD2:
1986 const SfxPoolItem& rItem = pItemSet->Get(ATTR_BORDER);
1987 SvxBoxItem aOuter(static_cast<const SvxBoxItem&>(rItem));
1988 SvxBoxInfoItem aInner(ATTR_BORDER_INNER);
1989 if (nWhich == SC_WID_UNO_TBLBORD2)
1990 ScHelperFunctions::AssignTableBorder2ToAny(aAny, aOuter, aInner,
1991 true);
1992 else
1993 ScHelperFunctions::AssignTableBorderToAny(aAny, aOuter, aInner,
1994 true);
1996 break;
1999 else if ( nWhich == SDRATTR_TEXTDIRECTION )
2001 aAny <<= false;
2003 else if ( nWhich == OWN_ATTR_FILLBMP_MODE )
2005 const XFillBmpStretchItem* pStretchItem = pItemSet->GetItem<XFillBmpStretchItem>(XATTR_FILLBMP_STRETCH);
2006 const XFillBmpTileItem* pTileItem = pItemSet->GetItem<XFillBmpTileItem>(XATTR_FILLBMP_TILE);
2008 if ( pStretchItem && pTileItem )
2010 if ( pTileItem->GetValue() )
2011 aAny <<= css::drawing::BitmapMode_REPEAT;
2012 else if ( pStretchItem->GetValue() )
2013 aAny <<= css::drawing::BitmapMode_STRETCH;
2014 else
2015 aAny <<= css::drawing::BitmapMode_NO_REPEAT;
2018 else if ( nWhich != OWN_ATTR_TEXTCOLUMNS )
2020 if (!SvxUnoTextRangeBase::GetPropertyValueHelper(*pItemSet, pResultEntry, aAny))
2021 aAny = SvxItemPropertySet_getPropertyValue(pResultEntry, *pItemSet);
2023 // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here
2024 if (pResultEntry->aType == ::cppu::UnoType<sal_Int16>::get() &&
2025 aAny.getValueType() == ::cppu::UnoType<sal_Int32>::get())
2027 aAny <<= static_cast<sal_Int16>(aAny.get<sal_Int32>());
2033 return aAny;
2036 uno::Any SAL_CALL ScStyleObj::getPropertyValue( const OUString& aPropertyName )
2038 SolarMutexGuard aGuard;
2039 GetStyle_Impl();
2041 return getPropertyValue_Impl( aPropertyName );
2044 SC_IMPL_DUMMY_PROPERTY_LISTENER( ScStyleObj )
2046 // lang::XServiceInfo
2048 OUString SAL_CALL ScStyleObj::getImplementationName()
2050 return u"ScStyleObj"_ustr;
2053 sal_Bool SAL_CALL ScStyleObj::supportsService( const OUString& rServiceName )
2055 return cppu::supportsService(this, rServiceName);
2058 uno::Sequence<OUString> SAL_CALL ScStyleObj::getSupportedServiceNames()
2060 if (eFamily == SfxStyleFamily::Page)
2061 return {SCSTYLE_SERVICE, SCPAGESTYLE_SERVICE};
2063 if (eFamily == SfxStyleFamily::Frame)
2064 return {SCSTYLE_SERVICE, SCGRAPHICSTYLE_SERVICE};
2066 return {SCSTYLE_SERVICE, SCCELLSTYLE_SERVICE};
2069 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */