Coverage Report

Created: 2026-03-31 11:00

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