1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "scitems.hxx"
21 #include <editeng/memberids.hrc>
22 #include <svx/algitem.hxx>
23 #include <editeng/boxitem.hxx>
24 #include <editeng/langitem.hxx>
25 #include <editeng/numitem.hxx>
26 #include <svx/pageitem.hxx>
27 #include <editeng/pbinitem.hxx>
28 #include <svx/unomid.hxx>
29 #include <editeng/unonrule.hxx>
30 #include <sfx2/bindings.hxx>
31 #include <sfx2/printer.hxx>
32 #include <vcl/virdev.hxx>
33 #include <vcl/svapp.hxx>
34 #include <svl/itempool.hxx>
35 #include <svl/itemset.hxx>
36 #include <svl/intitem.hxx>
37 #include <svl/zformat.hxx>
39 #include <com/sun/star/table/BorderLine.hpp>
40 #include <com/sun/star/table/CellVertJustify2.hpp>
41 #include <com/sun/star/table/TableBorder.hpp>
42 #include <com/sun/star/table/ShadowFormat.hpp>
43 #include <com/sun/star/table/CellHoriJustify.hpp>
44 #include <com/sun/star/table/CellOrientation.hpp>
45 #include <com/sun/star/style/PageStyleLayout.hpp>
46 #include <com/sun/star/style/GraphicLocation.hpp>
47 #include <com/sun/star/sheet/XHeaderFooterContent.hpp>
48 #include <com/sun/star/util/CellProtection.hpp>
49 #include <com/sun/star/awt/FontSlant.hpp>
50 #include <com/sun/star/awt/Size.hpp>
51 #include <com/sun/star/lang/Locale.hpp>
52 #include <com/sun/star/beans/PropertyAttribute.hpp>
54 #include "styleuno.hxx"
57 #include "stlpool.hxx"
58 #include "docpool.hxx"
59 #include "miscuno.hxx"
60 #include "convuno.hxx"
61 #include "tablink.hxx"
62 #include "unonames.hxx"
63 #include "unowids.hxx"
64 #include "globstr.hrc"
65 #include "cellsuno.hxx"
66 #include "stylehelper.hxx"
68 using namespace ::com::sun::star
;
70 //------------------------------------------------------------------------
72 static const SfxItemPropertySet
* lcl_GetCellStyleSet()
74 static const SfxItemPropertyMapEntry aCellStyleMap_Impl
[] =
76 {MAP_CHAR_LEN(SC_UNONAME_ASIANVERT
),ATTR_VERTICAL_ASIAN
,&getBooleanCppuType(), 0, 0 },
77 {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER
),ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, BOTTOM_BORDER
| CONVERT_TWIPS
},
78 {MAP_CHAR_LEN(SC_UNONAME_BOTTBORDER2
),ATTR_BORDER
, &::getCppuType((const table::BorderLine2
*)0), 0, BOTTOM_BORDER
| CONVERT_TWIPS
},
79 {MAP_CHAR_LEN(SC_UNONAME_CELLBACK
), ATTR_BACKGROUND
, &::getCppuType((const sal_Int32
*)0), 0, MID_BACK_COLOR
},
80 {MAP_CHAR_LEN(SC_UNONAME_CELLPRO
), ATTR_PROTECTION
, &::getCppuType((const util::CellProtection
*)0), 0, 0 },
81 {MAP_CHAR_LEN(SC_UNONAME_CCOLOR
), ATTR_FONT_COLOR
, &::getCppuType((const sal_Int32
*)0), 0, 0 },
82 {MAP_CHAR_LEN(SC_UNONAME_COUTL
), ATTR_FONT_CONTOUR
, &::getBooleanCppuType(), 0, 0 },
83 {MAP_CHAR_LEN(SC_UNONAME_CCROSS
), ATTR_FONT_CROSSEDOUT
,&::getBooleanCppuType(), 0, MID_CROSSED_OUT
},
84 {MAP_CHAR_LEN(SC_UNONAME_CEMPHAS
), ATTR_FONT_EMPHASISMARK
,&getCppuType((sal_Int16
*)0), 0, MID_EMPHASIS
},
85 {MAP_CHAR_LEN(SC_UNONAME_CFONT
), ATTR_FONT
, &::getCppuType((const sal_Int16
*)0), 0, MID_FONT_FAMILY
},
86 {MAP_CHAR_LEN(SC_UNONAME_CFCHARS
), ATTR_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_CHAR_SET
},
87 {MAP_CHAR_LEN(SC_UNO_CJK_CFCHARS
), ATTR_CJK_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_CHAR_SET
},
88 {MAP_CHAR_LEN(SC_UNO_CTL_CFCHARS
), ATTR_CTL_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_CHAR_SET
},
89 {MAP_CHAR_LEN(SC_UNONAME_CFFAMIL
), ATTR_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_FAMILY
},
90 {MAP_CHAR_LEN(SC_UNO_CJK_CFFAMIL
), ATTR_CJK_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_FAMILY
},
91 {MAP_CHAR_LEN(SC_UNO_CTL_CFFAMIL
), ATTR_CTL_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_FAMILY
},
92 {MAP_CHAR_LEN(SC_UNONAME_CFNAME
), ATTR_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_FAMILY_NAME
},
93 {MAP_CHAR_LEN(SC_UNO_CJK_CFNAME
), ATTR_CJK_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_FAMILY_NAME
},
94 {MAP_CHAR_LEN(SC_UNO_CTL_CFNAME
), ATTR_CTL_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_FAMILY_NAME
},
95 {MAP_CHAR_LEN(SC_UNONAME_CFPITCH
), ATTR_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_PITCH
},
96 {MAP_CHAR_LEN(SC_UNO_CJK_CFPITCH
), ATTR_CJK_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_PITCH
},
97 {MAP_CHAR_LEN(SC_UNO_CTL_CFPITCH
), ATTR_CTL_FONT
, &getCppuType((sal_Int16
*)0), 0, MID_FONT_PITCH
},
98 {MAP_CHAR_LEN(SC_UNONAME_CFSTYLE
), ATTR_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_STYLE_NAME
},
99 {MAP_CHAR_LEN(SC_UNO_CJK_CFSTYLE
), ATTR_CJK_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_STYLE_NAME
},
100 {MAP_CHAR_LEN(SC_UNO_CTL_CFSTYLE
), ATTR_CTL_FONT
, &getCppuType((OUString
*)0), 0, MID_FONT_STYLE_NAME
},
101 {MAP_CHAR_LEN(SC_UNONAME_CHEIGHT
), ATTR_FONT_HEIGHT
, &::getCppuType((const float*)0), 0, MID_FONTHEIGHT
| CONVERT_TWIPS
},
102 {MAP_CHAR_LEN(SC_UNO_CJK_CHEIGHT
), ATTR_CJK_FONT_HEIGHT
,&::getCppuType((const float*)0), 0, MID_FONTHEIGHT
| CONVERT_TWIPS
},
103 {MAP_CHAR_LEN(SC_UNO_CTL_CHEIGHT
), ATTR_CTL_FONT_HEIGHT
,&::getCppuType((const float*)0), 0, MID_FONTHEIGHT
| CONVERT_TWIPS
},
104 {MAP_CHAR_LEN(SC_UNONAME_CLOCAL
), ATTR_FONT_LANGUAGE
, &::getCppuType((const lang::Locale
*)0), 0, MID_LANG_LOCALE
},
105 {MAP_CHAR_LEN(SC_UNO_CJK_CLOCAL
), ATTR_CJK_FONT_LANGUAGE
,&::getCppuType((const lang::Locale
*)0), 0, MID_LANG_LOCALE
},
106 {MAP_CHAR_LEN(SC_UNO_CTL_CLOCAL
), ATTR_CTL_FONT_LANGUAGE
,&::getCppuType((const lang::Locale
*)0), 0, MID_LANG_LOCALE
},
107 {MAP_CHAR_LEN(SC_UNONAME_COVER
), ATTR_FONT_OVERLINE
, &::getCppuType((const sal_Int16
*)0), 0, MID_TL_STYLE
},
108 {MAP_CHAR_LEN(SC_UNONAME_COVRLCOL
), ATTR_FONT_OVERLINE
, &getCppuType((sal_Int32
*)0), 0, MID_TL_COLOR
},
109 {MAP_CHAR_LEN(SC_UNONAME_COVRLHAS
), ATTR_FONT_OVERLINE
, &getBooleanCppuType(), 0, MID_TL_HASCOLOR
},
110 {MAP_CHAR_LEN(SC_UNONAME_CPOST
), ATTR_FONT_POSTURE
, &::getCppuType((const awt::FontSlant
*)0), 0, MID_POSTURE
},
111 {MAP_CHAR_LEN(SC_UNO_CJK_CPOST
), ATTR_CJK_FONT_POSTURE
,&::getCppuType((const awt::FontSlant
*)0), 0, MID_POSTURE
},
112 {MAP_CHAR_LEN(SC_UNO_CTL_CPOST
), ATTR_CTL_FONT_POSTURE
,&::getCppuType((const awt::FontSlant
*)0), 0, MID_POSTURE
},
113 {MAP_CHAR_LEN(SC_UNONAME_CRELIEF
), ATTR_FONT_RELIEF
, &getCppuType((sal_Int16
*)0), 0, MID_RELIEF
},
114 {MAP_CHAR_LEN(SC_UNONAME_CSHADD
), ATTR_FONT_SHADOWED
, &::getBooleanCppuType(), 0, 0 },
115 {MAP_CHAR_LEN(SC_UNONAME_CSTRIKE
), ATTR_FONT_CROSSEDOUT
,&getCppuType((sal_Int16
*)0), 0, MID_CROSS_OUT
},
116 {MAP_CHAR_LEN(SC_UNONAME_CUNDER
), ATTR_FONT_UNDERLINE
,&::getCppuType((const sal_Int16
*)0), 0, MID_TL_STYLE
},
117 {MAP_CHAR_LEN(SC_UNONAME_CUNDLCOL
), ATTR_FONT_UNDERLINE
,&getCppuType((sal_Int32
*)0), 0, MID_TL_COLOR
},
118 {MAP_CHAR_LEN(SC_UNONAME_CUNDLHAS
), ATTR_FONT_UNDERLINE
,&getBooleanCppuType(), 0, MID_TL_HASCOLOR
},
119 {MAP_CHAR_LEN(SC_UNONAME_CWEIGHT
), ATTR_FONT_WEIGHT
, &::getCppuType((const float*)0), 0, MID_WEIGHT
},
120 {MAP_CHAR_LEN(SC_UNO_CJK_CWEIGHT
), ATTR_CJK_FONT_WEIGHT
,&::getCppuType((const float*)0), 0, MID_WEIGHT
},
121 {MAP_CHAR_LEN(SC_UNO_CTL_CWEIGHT
), ATTR_CTL_FONT_WEIGHT
,&::getCppuType((const float*)0), 0, MID_WEIGHT
},
122 {MAP_CHAR_LEN(SC_UNONAME_CWORDMOD
), ATTR_FONT_WORDLINE
, &getBooleanCppuType(), 0, 0 },
123 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR
), ATTR_BORDER_BLTR
, &::getCppuType((const table::BorderLine
*)0), 0, 0 | CONVERT_TWIPS
},
124 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_BLTR2
), ATTR_BORDER_BLTR
, &::getCppuType((const table::BorderLine2
*)0), 0, 0 | CONVERT_TWIPS
},
125 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR
), ATTR_BORDER_TLBR
, &::getCppuType((const table::BorderLine
*)0), 0, 0 | CONVERT_TWIPS
},
126 {MAP_CHAR_LEN(SC_UNONAME_DIAGONAL_TLBR2
), ATTR_BORDER_TLBR
, &::getCppuType((const table::BorderLine2
*)0), 0, 0 | CONVERT_TWIPS
},
127 {MAP_CHAR_LEN(SC_UNONAME_DISPNAME
), SC_WID_UNO_DISPNAME
,&::getCppuType((OUString
*)0), beans::PropertyAttribute::READONLY
, 0 },
128 {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS
), ATTR_HOR_JUSTIFY
, &::getCppuType((const table::CellHoriJustify
*)0), 0, MID_HORJUST_HORJUST
},
129 {MAP_CHAR_LEN(SC_UNONAME_CELLHJUS_METHOD
), ATTR_HOR_JUSTIFY_METHOD
, &::getCppuType((const sal_Int32
*)0), 0, 0 },
130 {MAP_CHAR_LEN(SC_UNONAME_CELLTRAN
), ATTR_BACKGROUND
, &::getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT
},
131 {MAP_CHAR_LEN(SC_UNONAME_WRAP
), ATTR_LINEBREAK
, &::getBooleanCppuType(), 0, 0 },
132 {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER
),ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, LEFT_BORDER
| CONVERT_TWIPS
},
133 {MAP_CHAR_LEN(SC_UNONAME_LEFTBORDER2
),ATTR_BORDER
, &::getCppuType((const table::BorderLine2
*)0), 0, LEFT_BORDER
| CONVERT_TWIPS
},
134 {MAP_CHAR_LEN(SC_UNONAME_NUMFMT
), ATTR_VALUE_FORMAT
, &::getCppuType((const sal_Int32
*)0), 0, 0 },
135 // {MAP_CHAR_LEN(SC_UNONAME_NUMRULES), SC_WID_UNO_NUMRULES,&getCppuType((const uno::Reference<container::XIndexReplace>*)0), 0, 0 },
136 {MAP_CHAR_LEN(SC_UNONAME_CELLORI
), ATTR_STACKED
, &::getCppuType((const table::CellOrientation
*)0), 0, 0 },
137 {MAP_CHAR_LEN(SC_UNONAME_PADJUST
), ATTR_HOR_JUSTIFY
, &::getCppuType((const sal_Int16
*)0), 0, MID_HORJUST_ADJUST
},
138 {MAP_CHAR_LEN(SC_UNONAME_PBMARGIN
), ATTR_MARGIN
, &::getCppuType((const sal_Int32
*)0), 0, MID_MARGIN_LO_MARGIN
| CONVERT_TWIPS
},
139 {MAP_CHAR_LEN(SC_UNONAME_PINDENT
), ATTR_INDENT
, &::getCppuType((const sal_Int16
*)0), 0, 0 }, //! CONVERT_TWIPS
140 {MAP_CHAR_LEN(SC_UNONAME_PISCHDIST
),ATTR_SCRIPTSPACE
, &::getBooleanCppuType(), 0, 0 },
141 {MAP_CHAR_LEN(SC_UNONAME_PISFORBID
),ATTR_FORBIDDEN_RULES
,&::getBooleanCppuType(), 0, 0 },
142 {MAP_CHAR_LEN(SC_UNONAME_PISHANG
), ATTR_HANGPUNCTUATION
,&::getBooleanCppuType(), 0, 0 },
143 {MAP_CHAR_LEN(SC_UNONAME_PISHYPHEN
),ATTR_HYPHENATE
, &getBooleanCppuType(), 0, 0 },
144 {MAP_CHAR_LEN(SC_UNONAME_PLASTADJ
), ATTR_HOR_JUSTIFY
, &::getCppuType((const sal_Int16
*)0), 0, MID_HORJUST_ADJUST
},
145 {MAP_CHAR_LEN(SC_UNONAME_PLMARGIN
), ATTR_MARGIN
, &::getCppuType((const sal_Int32
*)0), 0, MID_MARGIN_L_MARGIN
| CONVERT_TWIPS
},
146 {MAP_CHAR_LEN(SC_UNONAME_PRMARGIN
), ATTR_MARGIN
, &::getCppuType((const sal_Int32
*)0), 0, MID_MARGIN_R_MARGIN
| CONVERT_TWIPS
},
147 {MAP_CHAR_LEN(SC_UNONAME_PTMARGIN
), ATTR_MARGIN
, &::getCppuType((const sal_Int32
*)0), 0, MID_MARGIN_UP_MARGIN
| CONVERT_TWIPS
},
148 {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER
),ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, RIGHT_BORDER
| CONVERT_TWIPS
},
149 {MAP_CHAR_LEN(SC_UNONAME_RIGHTBORDER2
),ATTR_BORDER
, &::getCppuType((const table::BorderLine2
*)0), 0, RIGHT_BORDER
| CONVERT_TWIPS
},
150 {MAP_CHAR_LEN(SC_UNONAME_ROTANG
), ATTR_ROTATE_VALUE
, &::getCppuType((const sal_Int32
*)0), 0, 0 },
151 {MAP_CHAR_LEN(SC_UNONAME_ROTREF
), ATTR_ROTATE_MODE
, &::getCppuType((const sal_Int32
*)0), 0, 0 },
152 {MAP_CHAR_LEN(SC_UNONAME_SHADOW
), ATTR_SHADOW
, &::getCppuType((const table::ShadowFormat
*)0), 0, 0 | CONVERT_TWIPS
},
153 {MAP_CHAR_LEN(SC_UNONAME_SHRINK_TO_FIT
), ATTR_SHRINKTOFIT
, &getBooleanCppuType(), 0, 0 },
154 {MAP_CHAR_LEN(SC_UNONAME_TBLBORD
), SC_WID_UNO_TBLBORD
, &::getCppuType((const table::TableBorder
*)0), 0, 0 | CONVERT_TWIPS
},
155 {MAP_CHAR_LEN(SC_UNONAME_TBLBORD
), SC_WID_UNO_TBLBORD2
, &::getCppuType((const table::TableBorder2
*)0), 0, 0 | CONVERT_TWIPS
},
156 {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER
),ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, TOP_BORDER
| CONVERT_TWIPS
},
157 {MAP_CHAR_LEN(SC_UNONAME_TOPBORDER2
),ATTR_BORDER
, &::getCppuType((const table::BorderLine2
*)0), 0, TOP_BORDER
| CONVERT_TWIPS
},
158 {MAP_CHAR_LEN(SC_UNONAME_USERDEF
), ATTR_USERDEF
, &getCppuType((uno::Reference
<container::XNameContainer
>*)0), 0, 0 },
159 {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS
), ATTR_VER_JUSTIFY
, &::getCppuType((const sal_Int32
*)0), 0, 0 },
160 {MAP_CHAR_LEN(SC_UNONAME_CELLVJUS_METHOD
), ATTR_VER_JUSTIFY_METHOD
, &::getCppuType((const sal_Int32
*)0), 0, 0 },
161 {MAP_CHAR_LEN(SC_UNONAME_WRITING
), ATTR_WRITINGDIR
, &getCppuType((sal_Int16
*)0), 0, 0 },
162 {MAP_CHAR_LEN(SC_UNONAME_HIDDEN
), ATTR_HIDDEN
, &getCppuType((sal_Bool
*)0), 0, 0 },
163 {MAP_CHAR_LEN(SC_UNONAME_HYPERLINK
), ATTR_HYPERLINK
, &getCppuType((OUString
*)0), 0, 0 },
166 static SfxItemPropertySet
aCellStyleSet_Impl( aCellStyleMap_Impl
);
167 return &aCellStyleSet_Impl
;
170 // Map mit allen Seitenattributen, incl. Kopf-/Fusszeilenattribute
172 static const SfxItemPropertySet
* lcl_GetPageStyleSet()
174 static const SfxItemPropertyMapEntry aPageStyleMap_Impl
[] =
176 {MAP_CHAR_LEN(SC_UNO_PAGE_BACKCOLOR
), ATTR_BACKGROUND
, &::getCppuType((const sal_Int32
*)0), 0, MID_BACK_COLOR
},
177 {MAP_CHAR_LEN(SC_UNO_PAGE_GRAPHICFILT
), ATTR_BACKGROUND
, &::getCppuType((const OUString
*)0), 0, MID_GRAPHIC_FILTER
},
178 {MAP_CHAR_LEN(SC_UNO_PAGE_GRAPHICLOC
), ATTR_BACKGROUND
, &::getCppuType((const style::GraphicLocation
*)0), 0, MID_GRAPHIC_POSITION
},
179 {MAP_CHAR_LEN(SC_UNO_PAGE_GRAPHICURL
), ATTR_BACKGROUND
, &::getCppuType((const OUString
*)0), 0, MID_GRAPHIC_URL
},
180 {MAP_CHAR_LEN(SC_UNO_PAGE_BACKTRANS
), ATTR_BACKGROUND
, &::getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT
},
181 {MAP_CHAR_LEN(OLD_UNO_PAGE_BACKCOLOR
), ATTR_BACKGROUND
, &::getCppuType((const sal_Int32
*)0), 0, MID_BACK_COLOR
},
182 {MAP_CHAR_LEN(SC_UNO_PAGE_BORDERDIST
), ATTR_BORDER
, &::getCppuType((const sal_Int32
*)0), 0, BORDER_DISTANCE
| CONVERT_TWIPS
},
183 {MAP_CHAR_LEN(SC_UNO_PAGE_BOTTBORDER
), ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, BOTTOM_BORDER
| CONVERT_TWIPS
},
184 {MAP_CHAR_LEN(SC_UNO_PAGE_BOTTBRDDIST
), ATTR_BORDER
, &::getCppuType((const sal_Int32
*)0), 0, BOTTOM_BORDER_DISTANCE
| CONVERT_TWIPS
},
185 {MAP_CHAR_LEN(SC_UNO_PAGE_BOTTMARGIN
), ATTR_ULSPACE
, &::getCppuType((const sal_Int32
*)0), 0, MID_LO_MARGIN
| CONVERT_TWIPS
},
186 {MAP_CHAR_LEN(SC_UNO_PAGE_CENTERHOR
), ATTR_PAGE_HORCENTER
,&::getBooleanCppuType(), 0, 0 },
187 {MAP_CHAR_LEN(SC_UNO_PAGE_CENTERVER
), ATTR_PAGE_VERCENTER
,&::getBooleanCppuType(), 0, 0 },
188 {MAP_CHAR_LEN(SC_UNONAME_DISPNAME
), SC_WID_UNO_DISPNAME
,&::getCppuType((OUString
*)0), beans::PropertyAttribute::READONLY
, 0 },
189 {MAP_CHAR_LEN(SC_UNO_PAGE_FIRSTPAGE
), ATTR_PAGE_FIRSTPAGENO
,&::getCppuType((const sal_Int16
*)0), 0, 0 },
191 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRBACKCOL
), SC_WID_UNO_FOOTERSET
,&::getCppuType((const sal_Int32
*)0), 0, 0 },
192 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFFILT
), SC_WID_UNO_FOOTERSET
,&::getCppuType((const OUString
*)0), 0, 0 },
193 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFLOC
), SC_WID_UNO_FOOTERSET
,&::getCppuType((const style::GraphicLocation
*)0), 0, 0 },
194 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFURL
), SC_WID_UNO_FOOTERSET
,&::getCppuType((const OUString
*)0), 0, 0 },
195 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRBACKTRAN
), SC_WID_UNO_FOOTERSET
,&::getBooleanCppuType(), 0, 0 },
196 {MAP_CHAR_LEN(OLD_UNO_PAGE_FTRBACKCOL
), SC_WID_UNO_FOOTERSET
,&::getCppuType((const sal_Int32
*)0), 0, 0 },
197 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRBODYDIST
), SC_WID_UNO_FOOTERSET
,&::getCppuType((const sal_Int32
*)0), 0, 0 },
198 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRBRDDIST
), SC_WID_UNO_FOOTERSET
,&::getCppuType((const sal_Int32
*)0), 0, 0 },
199 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRBOTTBOR
), SC_WID_UNO_FOOTERSET
,&::getCppuType((const table::BorderLine
*)0), 0, 0 },
200 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRBOTTBDIS
), SC_WID_UNO_FOOTERSET
,&::getCppuType((const sal_Int32
*)0), 0, 0 },
201 {MAP_CHAR_LEN(OLD_UNO_PAGE_FTRDYNAMIC
), SC_WID_UNO_FOOTERSET
,&::getBooleanCppuType(), 0, 0 },
202 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRHEIGHT
), SC_WID_UNO_FOOTERSET
,&::getCppuType((const sal_Int32
*)0), 0, 0 },
203 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRDYNAMIC
), SC_WID_UNO_FOOTERSET
,&::getBooleanCppuType(), 0, 0 },
204 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRON
), SC_WID_UNO_FOOTERSET
,&::getBooleanCppuType(), 0, 0 },
205 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRSHARED
), SC_WID_UNO_FOOTERSET
,&::getBooleanCppuType(), 0, 0 },
206 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTBOR
), SC_WID_UNO_FOOTERSET
,&::getCppuType((const table::BorderLine
*)0), 0, 0 },
207 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTBDIS
), SC_WID_UNO_FOOTERSET
,&::getCppuType((const sal_Int32
*)0), 0, 0 },
208 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTMAR
), SC_WID_UNO_FOOTERSET
,&::getCppuType((const sal_Int32
*)0), 0, 0 },
209 {MAP_CHAR_LEN(OLD_UNO_PAGE_FTRON
), SC_WID_UNO_FOOTERSET
,&::getBooleanCppuType(), 0, 0 },
210 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTBOR
), SC_WID_UNO_FOOTERSET
,&::getCppuType((const table::BorderLine
*)0), 0, 0 },
211 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTBDIS
),SC_WID_UNO_FOOTERSET
,&::getCppuType((const sal_Int32
*)0), 0, 0 },
212 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTMAR
), SC_WID_UNO_FOOTERSET
,&::getCppuType((const sal_Int32
*)0), 0, 0 },
213 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRSHADOW
), SC_WID_UNO_FOOTERSET
,&::getCppuType((const table::ShadowFormat
*)0), 0, 0 },
214 {MAP_CHAR_LEN(OLD_UNO_PAGE_FTRSHARED
), SC_WID_UNO_FOOTERSET
,&::getBooleanCppuType(), 0, 0 },
215 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRTOPBOR
), SC_WID_UNO_FOOTERSET
,&::getCppuType((const table::BorderLine
*)0), 0, 0 },
216 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRTOPBDIS
), SC_WID_UNO_FOOTERSET
,&::getCppuType((const sal_Int32
*)0), 0, 0 },
218 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRBACKCOL
), SC_WID_UNO_HEADERSET
,&::getCppuType((const sal_Int32
*)0), 0, 0 },
219 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFFILT
), SC_WID_UNO_HEADERSET
,&::getCppuType((const OUString
*)0), 0, 0 },
220 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFLOC
), SC_WID_UNO_HEADERSET
,&::getCppuType((const style::GraphicLocation
*)0), 0, 0 },
221 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFURL
), SC_WID_UNO_HEADERSET
,&::getCppuType((const OUString
*)0), 0, 0 },
222 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRBACKTRAN
), SC_WID_UNO_HEADERSET
,&::getBooleanCppuType(), 0, 0 },
223 {MAP_CHAR_LEN(OLD_UNO_PAGE_HDRBACKCOL
), SC_WID_UNO_HEADERSET
,&::getCppuType((const sal_Int32
*)0), 0, 0 },
224 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRBODYDIST
), SC_WID_UNO_HEADERSET
,&::getCppuType((const sal_Int32
*)0), 0, 0 },
225 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRBRDDIST
), SC_WID_UNO_HEADERSET
,&::getCppuType((const sal_Int32
*)0), 0, 0 },
226 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRBOTTBOR
), SC_WID_UNO_HEADERSET
,&::getCppuType((const table::BorderLine
*)0), 0, 0 },
227 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRBOTTBDIS
), SC_WID_UNO_HEADERSET
,&::getCppuType((const sal_Int32
*)0), 0, 0 },
228 {MAP_CHAR_LEN(OLD_UNO_PAGE_HDRDYNAMIC
), SC_WID_UNO_HEADERSET
,&::getBooleanCppuType(), 0, 0 },
229 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRHEIGHT
), SC_WID_UNO_HEADERSET
,&::getCppuType((const sal_Int32
*)0), 0, 0 },
230 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRDYNAMIC
), SC_WID_UNO_HEADERSET
,&::getBooleanCppuType(), 0, 0 },
231 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRON
), SC_WID_UNO_HEADERSET
,&::getBooleanCppuType(), 0, 0 },
232 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRSHARED
), SC_WID_UNO_HEADERSET
,&::getBooleanCppuType(), 0, 0 },
233 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTBOR
), SC_WID_UNO_HEADERSET
,&::getCppuType((const table::BorderLine
*)0), 0, 0 },
234 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTBDIS
), SC_WID_UNO_HEADERSET
,&::getCppuType((const sal_Int32
*)0), 0, 0 },
235 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTMAR
), SC_WID_UNO_HEADERSET
,&::getCppuType((const sal_Int32
*)0), 0, 0 },
236 {MAP_CHAR_LEN(OLD_UNO_PAGE_HDRON
), SC_WID_UNO_HEADERSET
,&::getBooleanCppuType(), 0, 0 },
237 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTBOR
), SC_WID_UNO_HEADERSET
,&::getCppuType((const table::BorderLine
*)0), 0, 0 },
238 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTBDIS
),SC_WID_UNO_HEADERSET
,&::getCppuType((const sal_Int32
*)0), 0, 0 },
239 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTMAR
), SC_WID_UNO_HEADERSET
,&::getCppuType((const sal_Int32
*)0), 0, 0 },
240 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRSHADOW
), SC_WID_UNO_HEADERSET
,&::getCppuType((const table::ShadowFormat
*)0), 0, 0 },
241 {MAP_CHAR_LEN(OLD_UNO_PAGE_HDRSHARED
), SC_WID_UNO_HEADERSET
,&::getBooleanCppuType(), 0, 0 },
242 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRTOPBOR
), SC_WID_UNO_HEADERSET
,&::getCppuType((const table::BorderLine
*)0), 0, 0 },
243 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRTOPBDIS
), SC_WID_UNO_HEADERSET
,&::getCppuType((const sal_Int32
*)0), 0, 0 },
245 {MAP_CHAR_LEN(SC_UNO_PAGE_HEIGHT
), ATTR_PAGE_SIZE
, &::getCppuType((const sal_Int32
*)0), 0, MID_SIZE_HEIGHT
| CONVERT_TWIPS
},
246 {MAP_CHAR_LEN(OLD_UNO_PAGE_BACKTRANS
), ATTR_BACKGROUND
, &::getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT
},
247 {MAP_CHAR_LEN(SC_UNO_PAGE_LANDSCAPE
), ATTR_PAGE
, &::getBooleanCppuType(), 0, MID_PAGE_ORIENTATION
},
248 {MAP_CHAR_LEN(SC_UNO_PAGE_LEFTBORDER
), ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, LEFT_BORDER
| CONVERT_TWIPS
},
249 {MAP_CHAR_LEN(SC_UNO_PAGE_LEFTBRDDIST
), ATTR_BORDER
, &::getCppuType((const sal_Int32
*)0), 0, LEFT_BORDER_DISTANCE
| CONVERT_TWIPS
},
250 {MAP_CHAR_LEN(SC_UNO_PAGE_LEFTMARGIN
), ATTR_LRSPACE
, &::getCppuType((const sal_Int32
*)0), 0, MID_L_MARGIN
| CONVERT_TWIPS
},
251 {MAP_CHAR_LEN(SC_UNO_PAGE_LEFTFTRCONT
), ATTR_PAGE_FOOTERLEFT
,&::getCppuType((const uno::Reference
< sheet::XHeaderFooterContent
>*)0), 0, 0 },
252 {MAP_CHAR_LEN(SC_UNO_PAGE_LEFTHDRCONT
), ATTR_PAGE_HEADERLEFT
,&::getCppuType((const uno::Reference
< sheet::XHeaderFooterContent
>*)0), 0, 0 },
253 {MAP_CHAR_LEN(SC_UNO_PAGE_NUMBERTYPE
), ATTR_PAGE
, &::getCppuType((const sal_Int16
*)0), 0, MID_PAGE_NUMTYPE
},
254 {MAP_CHAR_LEN(SC_UNO_PAGE_SCALEVAL
), ATTR_PAGE_SCALE
, &::getCppuType((const sal_Int16
*)0), 0, 0 },
255 {MAP_CHAR_LEN(SC_UNO_PAGE_SYTLELAYOUT
), ATTR_PAGE
, &::getCppuType((const style::PageStyleLayout
*)0), 0, MID_PAGE_LAYOUT
},
256 {MAP_CHAR_LEN(SC_UNO_PAGE_PRINTANNOT
), ATTR_PAGE_NOTES
, &::getBooleanCppuType(), 0, 0 },
257 {MAP_CHAR_LEN(SC_UNO_PAGE_PRINTCHARTS
), ATTR_PAGE_CHARTS
, &::getBooleanCppuType(), 0, 0 },
258 {MAP_CHAR_LEN(SC_UNO_PAGE_PRINTDOWN
), ATTR_PAGE_TOPDOWN
, &::getBooleanCppuType(), 0, 0 },
259 {MAP_CHAR_LEN(SC_UNO_PAGE_PRINTDRAW
), ATTR_PAGE_DRAWINGS
, &::getBooleanCppuType(), 0, 0 },
260 {MAP_CHAR_LEN(SC_UNO_PAGE_PRINTFORMUL
), ATTR_PAGE_FORMULAS
, &::getBooleanCppuType(), 0, 0 },
261 {MAP_CHAR_LEN(SC_UNO_PAGE_PRINTGRID
), ATTR_PAGE_GRID
, &::getBooleanCppuType(), 0, 0 },
262 {MAP_CHAR_LEN(SC_UNO_PAGE_PRINTHEADER
), ATTR_PAGE_HEADERS
, &::getBooleanCppuType(), 0, 0 },
263 {MAP_CHAR_LEN(SC_UNO_PAGE_PRINTOBJS
), ATTR_PAGE_OBJECTS
, &::getBooleanCppuType(), 0, 0 },
264 {MAP_CHAR_LEN(SC_UNO_PAGE_PRINTZERO
), ATTR_PAGE_NULLVALS
, &::getBooleanCppuType(), 0, 0 },
265 {MAP_CHAR_LEN(SC_UNO_PAGE_PAPERTRAY
), ATTR_PAGE_PAPERBIN
, &::getCppuType((const OUString
*)0), 0, 0 },
266 {MAP_CHAR_LEN(SC_UNO_PAGE_RIGHTBORDER
), ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, RIGHT_BORDER
| CONVERT_TWIPS
},
267 {MAP_CHAR_LEN(SC_UNO_PAGE_RIGHTBRDDIST
),ATTR_BORDER
, &::getCppuType((const sal_Int32
*)0), 0, RIGHT_BORDER_DISTANCE
| CONVERT_TWIPS
},
268 {MAP_CHAR_LEN(SC_UNO_PAGE_RIGHTMARGIN
), ATTR_LRSPACE
, &::getCppuType((const sal_Int32
*)0), 0, MID_R_MARGIN
| CONVERT_TWIPS
},
269 {MAP_CHAR_LEN(SC_UNO_PAGE_RIGHTFTRCON
), ATTR_PAGE_FOOTERRIGHT
,&::getCppuType((const uno::Reference
< sheet::XHeaderFooterContent
>*)0), 0, 0 },
270 {MAP_CHAR_LEN(SC_UNO_PAGE_RIGHTHDRCON
), ATTR_PAGE_HEADERRIGHT
,&::getCppuType((const uno::Reference
< sheet::XHeaderFooterContent
>*)0), 0, 0 },
271 {MAP_CHAR_LEN(SC_UNO_PAGE_SCALETOPAG
), ATTR_PAGE_SCALETOPAGES
,&::getCppuType((const sal_Int16
*)0), 0, 0 },
272 {MAP_CHAR_LEN(SC_UNO_PAGE_SCALETOX
), ATTR_PAGE_SCALETO
, &::getCppuType((const sal_Int16
*)0), 0, 0 },
273 {MAP_CHAR_LEN(SC_UNO_PAGE_SCALETOY
), ATTR_PAGE_SCALETO
, &::getCppuType((const sal_Int16
*)0), 0, 0 },
274 {MAP_CHAR_LEN(SC_UNO_PAGE_SHADOWFORM
), ATTR_SHADOW
, &::getCppuType((const table::ShadowFormat
*)0), 0, 0 | CONVERT_TWIPS
},
275 {MAP_CHAR_LEN(SC_UNO_PAGE_SIZE
), ATTR_PAGE_SIZE
, &::getCppuType((const awt::Size
*)0), 0, MID_SIZE_SIZE
| CONVERT_TWIPS
},
276 {MAP_CHAR_LEN(SC_UNO_PAGE_TOPBORDER
), ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, TOP_BORDER
| CONVERT_TWIPS
},
277 {MAP_CHAR_LEN(SC_UNO_PAGE_TOPBRDDIST
), ATTR_BORDER
, &::getCppuType((const sal_Int32
*)0), 0, TOP_BORDER_DISTANCE
| CONVERT_TWIPS
},
278 {MAP_CHAR_LEN(SC_UNO_PAGE_TOPMARGIN
), ATTR_ULSPACE
, &::getCppuType((const sal_Int32
*)0), 0, MID_UP_MARGIN
| CONVERT_TWIPS
},
279 {MAP_CHAR_LEN(OLD_UNO_PAGE_FTRBACKTRAN
),SC_WID_UNO_FOOTERSET
,&::getBooleanCppuType(), 0, 0 },
280 {MAP_CHAR_LEN(OLD_UNO_PAGE_HDRBACKTRAN
),SC_WID_UNO_HEADERSET
,&::getBooleanCppuType(), 0, 0 },
281 {MAP_CHAR_LEN(SC_UNONAME_USERDEF
), ATTR_USERDEF
, &getCppuType((uno::Reference
<container::XNameContainer
>*)0), 0, 0 },
282 {MAP_CHAR_LEN(SC_UNO_PAGE_WIDTH
), ATTR_PAGE_SIZE
, &::getCppuType((const sal_Int32
*)0), 0, MID_SIZE_WIDTH
| CONVERT_TWIPS
},
283 {MAP_CHAR_LEN(SC_UNONAME_WRITING
), ATTR_WRITINGDIR
, &getCppuType((sal_Int16
*)0), 0, 0 },
284 {MAP_CHAR_LEN(SC_UNONAME_HIDDEN
), ATTR_HIDDEN
, &getCppuType((sal_Bool
*)0), 0, 0 },
287 static SfxItemPropertySet
aPageStyleSet_Impl( aPageStyleMap_Impl
);
288 return &aPageStyleSet_Impl
;
291 // Map mit Inhalten des Header-Item-Sets
293 static const SfxItemPropertyMap
* lcl_GetHeaderStyleMap()
295 static const SfxItemPropertyMapEntry aHeaderStyleMap_Impl
[] =
297 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRBACKCOL
), ATTR_BACKGROUND
, &::getCppuType((const sal_Int32
*)0), 0, MID_BACK_COLOR
},
298 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFFILT
), ATTR_BACKGROUND
, &::getCppuType((const OUString
*)0), 0, MID_GRAPHIC_FILTER
},
299 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFLOC
), ATTR_BACKGROUND
, &::getCppuType((const style::GraphicLocation
*)0), 0, MID_GRAPHIC_POSITION
},
300 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFURL
), ATTR_BACKGROUND
, &::getCppuType((const OUString
*)0), 0, MID_GRAPHIC_URL
},
301 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRBACKTRAN
), ATTR_BACKGROUND
, &::getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT
},
302 {MAP_CHAR_LEN(OLD_UNO_PAGE_HDRBACKCOL
), ATTR_BACKGROUND
, &::getCppuType((const sal_Int32
*)0), 0, MID_BACK_COLOR
},
303 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRBODYDIST
), ATTR_ULSPACE
, &::getCppuType((const sal_Int32
*)0), 0, MID_LO_MARGIN
| CONVERT_TWIPS
},
304 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRBRDDIST
), ATTR_BORDER
, &::getCppuType((const sal_Int32
*)0), 0, BORDER_DISTANCE
| CONVERT_TWIPS
},
305 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRBOTTBOR
), ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, BOTTOM_BORDER
| CONVERT_TWIPS
},
306 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRBOTTBDIS
), ATTR_BORDER
, &::getCppuType((const sal_Int32
*)0), 0, BOTTOM_BORDER_DISTANCE
| CONVERT_TWIPS
},
307 {MAP_CHAR_LEN(OLD_UNO_PAGE_HDRDYNAMIC
), ATTR_PAGE_DYNAMIC
, &::getBooleanCppuType(), 0, 0 },
308 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRHEIGHT
), ATTR_PAGE_SIZE
, &::getCppuType((const sal_Int32
*)0), 0, MID_SIZE_HEIGHT
| CONVERT_TWIPS
},
309 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRDYNAMIC
), ATTR_PAGE_DYNAMIC
, &::getBooleanCppuType(), 0, 0 },
310 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRON
), ATTR_PAGE_ON
, &::getBooleanCppuType(), 0, 0 },
311 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRSHARED
), ATTR_PAGE_SHARED
, &::getBooleanCppuType(), 0, 0 },
312 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTBOR
), ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, LEFT_BORDER
| CONVERT_TWIPS
},
313 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTBDIS
), ATTR_BORDER
, &::getCppuType((const sal_Int32
*)0), 0, LEFT_BORDER_DISTANCE
| CONVERT_TWIPS
},
314 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTMAR
), ATTR_LRSPACE
, &::getCppuType((const sal_Int32
*)0), 0, MID_L_MARGIN
| CONVERT_TWIPS
},
315 {MAP_CHAR_LEN(OLD_UNO_PAGE_HDRON
), ATTR_PAGE_ON
, &::getBooleanCppuType(), 0, 0 },
316 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTBOR
), ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, RIGHT_BORDER
| CONVERT_TWIPS
},
317 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTBDIS
),ATTR_BORDER
, &::getCppuType((const sal_Int32
*)0), 0, RIGHT_BORDER_DISTANCE
| CONVERT_TWIPS
},
318 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTMAR
), ATTR_LRSPACE
, &::getCppuType((const sal_Int32
*)0), 0, MID_R_MARGIN
| CONVERT_TWIPS
},
319 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRSHADOW
), ATTR_SHADOW
, &::getCppuType((const table::ShadowFormat
*)0), 0, 0 | CONVERT_TWIPS
},
320 {MAP_CHAR_LEN(OLD_UNO_PAGE_HDRSHARED
), ATTR_PAGE_SHARED
, &::getBooleanCppuType(), 0, 0 },
321 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRTOPBOR
), ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, TOP_BORDER
| CONVERT_TWIPS
},
322 {MAP_CHAR_LEN(SC_UNO_PAGE_HDRTOPBDIS
), ATTR_BORDER
, &::getCppuType((const sal_Int32
*)0), 0, TOP_BORDER_DISTANCE
| CONVERT_TWIPS
},
323 {MAP_CHAR_LEN(OLD_UNO_PAGE_HDRBACKTRAN
),ATTR_BACKGROUND
, &::getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT
},
326 static SfxItemPropertyMap
aHeaderStyleMap( aHeaderStyleMap_Impl
);
327 return &aHeaderStyleMap
;
330 // Map mit Inhalten des Footer-Item-Sets
332 static const SfxItemPropertyMap
* lcl_GetFooterStyleMap()
334 static const SfxItemPropertyMapEntry aFooterStyleMap_Impl
[] =
336 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRBACKCOL
), ATTR_BACKGROUND
, &::getCppuType((const sal_Int32
*)0), 0, MID_BACK_COLOR
},
337 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFFILT
), ATTR_BACKGROUND
, &::getCppuType((const OUString
*)0), 0, MID_GRAPHIC_FILTER
},
338 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFLOC
), ATTR_BACKGROUND
, &::getCppuType((const style::GraphicLocation
*)0), 0, MID_GRAPHIC_POSITION
},
339 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFURL
), ATTR_BACKGROUND
, &::getCppuType((const OUString
*)0), 0, MID_GRAPHIC_URL
},
340 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRBACKTRAN
), ATTR_BACKGROUND
, &::getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT
},
341 {MAP_CHAR_LEN(OLD_UNO_PAGE_FTRBACKCOL
), ATTR_BACKGROUND
, &::getCppuType((const sal_Int32
*)0), 0, MID_BACK_COLOR
},
342 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRBODYDIST
), ATTR_ULSPACE
, &::getCppuType((const sal_Int32
*)0), 0, MID_UP_MARGIN
| CONVERT_TWIPS
},
343 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRBRDDIST
), ATTR_BORDER
, &::getCppuType((const sal_Int32
*)0), 0, BORDER_DISTANCE
| CONVERT_TWIPS
},
344 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRBOTTBOR
), ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, BOTTOM_BORDER
| CONVERT_TWIPS
},
345 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRBOTTBDIS
), ATTR_BORDER
, &::getCppuType((const sal_Int32
*)0), 0, BOTTOM_BORDER_DISTANCE
| CONVERT_TWIPS
},
346 {MAP_CHAR_LEN(OLD_UNO_PAGE_FTRDYNAMIC
), ATTR_PAGE_DYNAMIC
, &::getBooleanCppuType(), 0, 0 },
347 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRHEIGHT
), ATTR_PAGE_SIZE
, &::getCppuType((const sal_Int32
*)0), 0, MID_SIZE_HEIGHT
| CONVERT_TWIPS
},
348 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRDYNAMIC
), ATTR_PAGE_DYNAMIC
, &::getBooleanCppuType(), 0, 0 },
349 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRON
), ATTR_PAGE_ON
, &::getBooleanCppuType(), 0, 0 },
350 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRSHARED
), ATTR_PAGE_SHARED
, &::getBooleanCppuType(), 0, 0 },
351 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTBOR
), ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, LEFT_BORDER
| CONVERT_TWIPS
},
352 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTBDIS
), ATTR_BORDER
, &::getCppuType((const sal_Int32
*)0), 0, LEFT_BORDER_DISTANCE
| CONVERT_TWIPS
},
353 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTMAR
), ATTR_LRSPACE
, &::getCppuType((const sal_Int32
*)0), 0, MID_L_MARGIN
| CONVERT_TWIPS
},
354 {MAP_CHAR_LEN(OLD_UNO_PAGE_FTRON
), ATTR_PAGE_ON
, &::getBooleanCppuType(), 0, 0 },
355 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTBOR
), ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, RIGHT_BORDER
| CONVERT_TWIPS
},
356 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTBDIS
),ATTR_BORDER
, &::getCppuType((const sal_Int32
*)0), 0, RIGHT_BORDER_DISTANCE
| CONVERT_TWIPS
},
357 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTMAR
), ATTR_LRSPACE
, &::getCppuType((const sal_Int32
*)0), 0, MID_R_MARGIN
| CONVERT_TWIPS
},
358 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRSHADOW
), ATTR_SHADOW
, &::getCppuType((const table::ShadowFormat
*)0), 0, 0 | CONVERT_TWIPS
},
359 {MAP_CHAR_LEN(OLD_UNO_PAGE_FTRSHARED
), ATTR_PAGE_SHARED
, &::getBooleanCppuType(), 0, 0 },
360 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRTOPBOR
), ATTR_BORDER
, &::getCppuType((const table::BorderLine
*)0), 0, TOP_BORDER
| CONVERT_TWIPS
},
361 {MAP_CHAR_LEN(SC_UNO_PAGE_FTRTOPBDIS
), ATTR_BORDER
, &::getCppuType((const sal_Int32
*)0), 0, TOP_BORDER_DISTANCE
| CONVERT_TWIPS
},
362 {MAP_CHAR_LEN(OLD_UNO_PAGE_FTRBACKTRAN
),ATTR_BACKGROUND
, &::getBooleanCppuType(), 0, MID_GRAPHIC_TRANSPARENT
},
365 static SfxItemPropertyMap
aFooterStyleMap( aFooterStyleMap_Impl
);
366 return &aFooterStyleMap
;
370 //------------------------------------------------------------------------
372 // Index-Access auf die Style-Typen: 0 = Cell, 1 = Page
374 #define SC_STYLE_FAMILY_COUNT 2
376 #define SC_FAMILYNAME_CELL "CellStyles"
377 #define SC_FAMILYNAME_PAGE "PageStyles"
379 static const sal_uInt16 aStyleFamilyTypes
[SC_STYLE_FAMILY_COUNT
] = { SFX_STYLE_FAMILY_PARA
, SFX_STYLE_FAMILY_PAGE
};
381 //------------------------------------------------------------------------
383 using sc::HMMToTwips
;
384 using sc::TwipsToHMM
;
386 //------------------------------------------------------------------------
388 #define SCSTYLE_SERVICE "com.sun.star.style.Style"
389 #define SCCELLSTYLE_SERVICE "com.sun.star.style.CellStyle"
390 #define SCPAGESTYLE_SERVICE "com.sun.star.style.PageStyle"
392 SC_SIMPLE_SERVICE_INFO( ScStyleFamiliesObj
, "ScStyleFamiliesObj", "com.sun.star.style.StyleFamilies" )
393 SC_SIMPLE_SERVICE_INFO( ScStyleFamilyObj
, "ScStyleFamilyObj", "com.sun.star.style.StyleFamily" )
395 //------------------------------------------------------------------------
397 #define SC_PAPERBIN_DEFAULTNAME "[From printer settings]"
399 //------------------------------------------------------------------------
401 static bool lcl_AnyTabProtected( ScDocument
& rDoc
)
403 SCTAB nTabCount
= rDoc
.GetTableCount();
404 for (SCTAB i
=0; i
<nTabCount
; i
++)
405 if (rDoc
.IsTabProtected(i
))
410 //------------------------------------------------------------------------
412 ScStyleFamiliesObj::ScStyleFamiliesObj(ScDocShell
* pDocSh
) :
415 pDocShell
->GetDocument()->AddUnoObject(*this);
418 ScStyleFamiliesObj::~ScStyleFamiliesObj()
421 pDocShell
->GetDocument()->RemoveUnoObject(*this);
424 void ScStyleFamiliesObj::Notify( SfxBroadcaster
&, const SfxHint
& rHint
)
426 // Referenz-Update interessiert hier nicht
428 if ( rHint
.ISA( SfxSimpleHint
) &&
429 ((const SfxSimpleHint
&)rHint
).GetId() == SFX_HINT_DYING
)
431 pDocShell
= NULL
; // ungueltig geworden
437 ScStyleFamilyObj
*ScStyleFamiliesObj::GetObjectByType_Impl(sal_uInt16 nType
) const
441 if ( nType
== SFX_STYLE_FAMILY_PARA
)
442 return new ScStyleFamilyObj( pDocShell
, SFX_STYLE_FAMILY_PARA
);
443 else if ( nType
== SFX_STYLE_FAMILY_PAGE
)
444 return new ScStyleFamilyObj( pDocShell
, SFX_STYLE_FAMILY_PAGE
);
446 OSL_FAIL("getStyleFamilyByType: keine DocShell oder falscher Typ");
450 ScStyleFamilyObj
* ScStyleFamiliesObj::GetObjectByIndex_Impl(sal_uInt32 nIndex
) const
452 if ( nIndex
< SC_STYLE_FAMILY_COUNT
)
453 return GetObjectByType_Impl(aStyleFamilyTypes
[nIndex
]);
455 return NULL
; // ungueltiger Index
458 ScStyleFamilyObj
* ScStyleFamiliesObj::GetObjectByName_Impl(const OUString
& aName
) const
462 OUString
aNameStr( aName
);
463 if ( aNameStr
.equalsAscii( SC_FAMILYNAME_CELL
) )
464 return new ScStyleFamilyObj( pDocShell
, SFX_STYLE_FAMILY_PARA
);
465 else if ( aNameStr
.equalsAscii( SC_FAMILYNAME_PAGE
) )
466 return new ScStyleFamilyObj( pDocShell
, SFX_STYLE_FAMILY_PAGE
);
468 // no assertion - called directly from getByName
472 // container::XIndexAccess
474 sal_Int32 SAL_CALL
ScStyleFamiliesObj::getCount() throw(uno::RuntimeException
)
476 return SC_STYLE_FAMILY_COUNT
;
479 uno::Any SAL_CALL
ScStyleFamiliesObj::getByIndex( sal_Int32 nIndex
)
480 throw(lang::IndexOutOfBoundsException
,
481 lang::WrappedTargetException
, uno::RuntimeException
)
483 SolarMutexGuard aGuard
;
484 uno::Reference
< container::XNameContainer
> xFamily(GetObjectByIndex_Impl(nIndex
));
486 return uno::makeAny(xFamily
);
488 throw lang::IndexOutOfBoundsException();
489 // return uno::Any();
492 uno::Type SAL_CALL
ScStyleFamiliesObj::getElementType() throw(uno::RuntimeException
)
494 SolarMutexGuard aGuard
;
495 return ::getCppuType((const uno::Reference
< container::XNameContainer
>*)0); // muss zu getByIndex passen
498 sal_Bool SAL_CALL
ScStyleFamiliesObj::hasElements() throw(uno::RuntimeException
)
500 SolarMutexGuard aGuard
;
501 return ( getCount() != 0 );
504 // container::XNameAccess
506 uno::Any SAL_CALL
ScStyleFamiliesObj::getByName( const OUString
& aName
)
507 throw(container::NoSuchElementException
,
508 lang::WrappedTargetException
, uno::RuntimeException
)
510 SolarMutexGuard aGuard
;
511 uno::Reference
< container::XNameContainer
> xFamily(GetObjectByName_Impl(aName
));
513 return uno::makeAny(xFamily
);
515 throw container::NoSuchElementException();
516 // return uno::Any();
519 uno::Sequence
<OUString
> SAL_CALL
ScStyleFamiliesObj::getElementNames()
520 throw(uno::RuntimeException
)
522 SolarMutexGuard aGuard
;
523 uno::Sequence
<OUString
> aNames(SC_STYLE_FAMILY_COUNT
);
524 OUString
* pNames
= aNames
.getArray();
525 pNames
[0] = OUString(SC_FAMILYNAME_CELL
);
526 pNames
[1] = OUString(SC_FAMILYNAME_PAGE
);
530 sal_Bool SAL_CALL
ScStyleFamiliesObj::hasByName( const OUString
& aName
)
531 throw(uno::RuntimeException
)
533 SolarMutexGuard aGuard
;
534 OUString
aNameStr( aName
);
535 return ( aNameStr
.equalsAscii( SC_FAMILYNAME_CELL
) || aNameStr
.equalsAscii( SC_FAMILYNAME_PAGE
) );
538 // style::XStyleLoader
540 void SAL_CALL
ScStyleFamiliesObj::loadStylesFromURL( const OUString
& aURL
,
541 const uno::Sequence
<beans::PropertyValue
>& aOptions
)
542 throw(io::IOException
, uno::RuntimeException
)
544 //! use aOptions (like Writer)
545 //! set flag to disable filter option dialogs when importing
547 OUString aFilter
; // empty - detect
549 ScDocumentLoader
aLoader( aURL
, aFilter
, aFiltOpt
);
551 ScDocShell
* pSource
= aLoader
.GetDocShell();
552 if ( pSource
&& pDocShell
)
556 sal_Bool bLoadReplace
= sal_True
; // defaults
557 sal_Bool bLoadCellStyles
= sal_True
;
558 sal_Bool bLoadPageStyles
= sal_True
;
560 const beans::PropertyValue
* pPropArray
= aOptions
.getConstArray();
561 long nPropCount
= aOptions
.getLength();
562 for (long i
= 0; i
< nPropCount
; i
++)
564 const beans::PropertyValue
& rProp
= pPropArray
[i
];
565 OUString
aPropName(rProp
.Name
);
567 if (aPropName
.equalsAscii( SC_UNONAME_OVERWSTL
))
568 bLoadReplace
= ScUnoHelpFunctions::GetBoolFromAny( rProp
.Value
);
569 else if (aPropName
.equalsAscii( SC_UNONAME_LOADCELL
))
570 bLoadCellStyles
= ScUnoHelpFunctions::GetBoolFromAny( rProp
.Value
);
571 else if (aPropName
.equalsAscii( SC_UNONAME_LOADPAGE
))
572 bLoadPageStyles
= ScUnoHelpFunctions::GetBoolFromAny( rProp
.Value
);
575 pDocShell
->LoadStylesArgs( *pSource
, bLoadReplace
, bLoadCellStyles
, bLoadPageStyles
);
576 pDocShell
->SetDocumentModified(); // paint is inside LoadStyles
580 uno::Sequence
<beans::PropertyValue
> SAL_CALL
ScStyleFamiliesObj::getStyleLoaderOptions()
581 throw(uno::RuntimeException
)
583 // return defaults for options (?)
585 uno::Sequence
<beans::PropertyValue
> aSequence(3);
586 beans::PropertyValue
* pArray
= aSequence
.getArray();
588 pArray
[0].Name
= OUString(SC_UNONAME_OVERWSTL
);
589 ScUnoHelpFunctions::SetBoolInAny( pArray
[0].Value
, true );
591 pArray
[1].Name
= OUString(SC_UNONAME_LOADCELL
);
592 ScUnoHelpFunctions::SetBoolInAny( pArray
[1].Value
, true );
594 pArray
[2].Name
= OUString(SC_UNONAME_LOADPAGE
);
595 ScUnoHelpFunctions::SetBoolInAny( pArray
[2].Value
, true );
600 //------------------------------------------------------------------------
602 ScStyleFamilyObj::ScStyleFamilyObj(ScDocShell
* pDocSh
, SfxStyleFamily eFam
) :
606 pDocShell
->GetDocument()->AddUnoObject(*this);
609 ScStyleFamilyObj::~ScStyleFamilyObj()
612 pDocShell
->GetDocument()->RemoveUnoObject(*this);
615 void ScStyleFamilyObj::Notify( SfxBroadcaster
&, const SfxHint
& rHint
)
617 // Referenz-Update interessiert hier nicht
619 if ( rHint
.ISA( SfxSimpleHint
) &&
620 ((const SfxSimpleHint
&)rHint
).GetId() == SFX_HINT_DYING
)
622 pDocShell
= NULL
; // ungueltig geworden
628 ScStyleObj
* ScStyleFamilyObj::GetObjectByIndex_Impl(sal_uInt32 nIndex
)
632 ScDocument
* pDoc
= pDocShell
->GetDocument();
633 ScStyleSheetPool
* pStylePool
= pDoc
->GetStyleSheetPool();
635 SfxStyleSheetIterator
aIter( pStylePool
, eFamily
);
636 if ( nIndex
< aIter
.Count() )
638 SfxStyleSheetBase
* pStyle
= aIter
[(sal_uInt16
)nIndex
];
641 return new ScStyleObj( pDocShell
, eFamily
, pStyle
->GetName() );
648 ScStyleObj
* ScStyleFamilyObj::GetObjectByName_Impl(const OUString
& aName
)
652 OUString
aString(aName
);
654 ScDocument
* pDoc
= pDocShell
->GetDocument();
655 ScStyleSheetPool
* pStylePool
= pDoc
->GetStyleSheetPool();
656 if ( pStylePool
->Find( aString
, eFamily
) )
657 return new ScStyleObj( pDocShell
, eFamily
, aString
);
662 void SAL_CALL
ScStyleFamilyObj::insertByName( const OUString
& aName
, const uno::Any
& aElement
)
663 throw(lang::IllegalArgumentException
, container::ElementExistException
,
664 lang::WrappedTargetException
, uno::RuntimeException
)
666 SolarMutexGuard aGuard
;
668 // Reflection muss nicht uno::XInterface sein, kann auch irgendein Interface sein...
669 uno::Reference
< uno::XInterface
> xInterface(aElement
, uno::UNO_QUERY
);
670 if ( xInterface
.is() )
672 ScStyleObj
* pStyleObj
= ScStyleObj::getImplementation( xInterface
);
673 if ( pStyleObj
&& pStyleObj
->GetFamily() == eFamily
&&
674 !pStyleObj
->IsInserted() ) // noch nicht eingefuegt?
676 OUString
aNameStr(ScStyleNameConversion::ProgrammaticToDisplayName( aName
, sal::static_int_cast
<sal_uInt16
>(eFamily
) ));
678 ScDocument
* pDoc
= pDocShell
->GetDocument();
679 ScStyleSheetPool
* pStylePool
= pDoc
->GetStyleSheetPool();
681 //! DocFunc-Funktion??
682 //! Undo ?????????????
684 if ( !pStylePool
->Find( aNameStr
, eFamily
) ) // noch nicht vorhanden
686 (void)pStylePool
->Make( aNameStr
, eFamily
, SFXSTYLEBIT_USERDEF
);
688 if ( eFamily
== SFX_STYLE_FAMILY_PARA
&& !pDoc
->IsImportingXML() )
689 pDoc
->GetPool()->CellStyleCreated( aNameStr
);
691 pStyleObj
->InitDoc( pDocShell
, aNameStr
); // Objekt kann benutzt werden
693 pDocShell
->SetDocumentModified(); // verwendet wird der neue Style noch nicht
697 throw container::ElementExistException();
703 // other errors are handled above
704 throw lang::IllegalArgumentException();
708 void SAL_CALL
ScStyleFamilyObj::replaceByName( const OUString
& aName
, const uno::Any
& aElement
)
709 throw(lang::IllegalArgumentException
, container::NoSuchElementException
,
710 lang::WrappedTargetException
, uno::RuntimeException
)
712 SolarMutexGuard aGuard
;
714 removeByName( aName
);
715 insertByName( aName
, aElement
);
718 void SAL_CALL
ScStyleFamilyObj::removeByName( const OUString
& aName
)
719 throw(container::NoSuchElementException
,
720 lang::WrappedTargetException
, uno::RuntimeException
)
722 SolarMutexGuard aGuard
;
726 OUString
aString(ScStyleNameConversion::ProgrammaticToDisplayName( aName
, sal::static_int_cast
<sal_uInt16
>(eFamily
) ));
728 ScDocument
* pDoc
= pDocShell
->GetDocument();
729 ScStyleSheetPool
* pStylePool
= pDoc
->GetStyleSheetPool();
731 //! DocFunc-Funktion??
732 //! Undo ?????????????
734 SfxStyleSheetBase
* pStyle
= pStylePool
->Find( aString
, eFamily
);
738 if ( eFamily
== SFX_STYLE_FAMILY_PARA
)
740 // wie ScViewFunc::RemoveStyleSheetInUse
742 Point aLogic
= aVDev
.LogicToPixel( Point(1000,1000), MAP_TWIP
);
743 double nPPTX
= aLogic
.X() / 1000.0;
744 double nPPTY
= aLogic
.Y() / 1000.0;
746 pDoc
->StyleSheetChanged( pStyle
, false, &aVDev
, nPPTX
, nPPTY
, aZoom
, aZoom
);
747 pDocShell
->PostPaint( 0,0,0, MAXCOL
,MAXROW
,MAXTAB
, PAINT_GRID
|PAINT_LEFT
);
748 pDocShell
->SetDocumentModified();
750 pStylePool
->Remove( pStyle
);
752 //! InvalidateAttribs(); // Bindings-Invalidate
756 if ( pDoc
->RemovePageStyleInUse( aString
) )
757 pDocShell
->PageStyleModified( ScGlobal::GetRscString(STR_STYLENAME_STANDARD
), sal_True
);
759 pStylePool
->Remove( pStyle
);
761 SfxBindings
* pBindings
= pDocShell
->GetViewBindings();
763 pBindings
->Invalidate( SID_STYLE_FAMILY4
);
764 pDocShell
->SetDocumentModified();
770 throw container::NoSuchElementException();
773 // container::XIndexAccess
775 sal_Int32 SAL_CALL
ScStyleFamilyObj::getCount() throw(uno::RuntimeException
)
777 SolarMutexGuard aGuard
;
780 ScDocument
* pDoc
= pDocShell
->GetDocument();
781 ScStyleSheetPool
* pStylePool
= pDoc
->GetStyleSheetPool();
783 SfxStyleSheetIterator
aIter( pStylePool
, eFamily
);
784 return aIter
.Count();
789 uno::Any SAL_CALL
ScStyleFamilyObj::getByIndex( sal_Int32 nIndex
)
790 throw(lang::IndexOutOfBoundsException
,
791 lang::WrappedTargetException
, uno::RuntimeException
)
793 SolarMutexGuard aGuard
;
794 uno::Reference
< style::XStyle
> xObj(GetObjectByIndex_Impl(nIndex
));
796 return uno::makeAny(xObj
);
798 throw lang::IndexOutOfBoundsException();
799 // return uno::Any();
802 uno::Type SAL_CALL
ScStyleFamilyObj::getElementType() throw(uno::RuntimeException
)
804 SolarMutexGuard aGuard
;
805 return ::getCppuType((const uno::Reference
< style::XStyle
>*)0); // muss zu getByIndex passen
808 sal_Bool SAL_CALL
ScStyleFamilyObj::hasElements() throw(uno::RuntimeException
)
810 SolarMutexGuard aGuard
;
811 return ( getCount() != 0 );
814 // container::XNameAccess
816 uno::Any SAL_CALL
ScStyleFamilyObj::getByName( const OUString
& aName
)
817 throw(container::NoSuchElementException
,
818 lang::WrappedTargetException
, uno::RuntimeException
)
820 SolarMutexGuard aGuard
;
821 uno::Reference
< style::XStyle
> xObj(
822 GetObjectByName_Impl( ScStyleNameConversion::ProgrammaticToDisplayName( aName
, sal::static_int_cast
<sal_uInt16
>(eFamily
) ) ));
824 return uno::makeAny(xObj
);
826 throw container::NoSuchElementException();
827 // return uno::Any();
830 uno::Sequence
<OUString
> SAL_CALL
ScStyleFamilyObj::getElementNames()
831 throw(uno::RuntimeException
)
833 SolarMutexGuard aGuard
;
836 ScDocument
* pDoc
= pDocShell
->GetDocument();
837 ScStyleSheetPool
* pStylePool
= pDoc
->GetStyleSheetPool();
839 SfxStyleSheetIterator
aIter( pStylePool
, eFamily
);
840 sal_uInt16 nCount
= aIter
.Count();
842 uno::Sequence
<OUString
> aSeq(nCount
);
843 OUString
* pAry
= aSeq
.getArray();
844 SfxStyleSheetBase
* pStyle
= aIter
.First();
848 OSL_ENSURE( nPos
<nCount
, "Anzahl durcheinandergekommen" );
850 pAry
[nPos
++] = ScStyleNameConversion::DisplayToProgrammaticName(
851 pStyle
->GetName(), sal::static_int_cast
<sal_uInt16
>(eFamily
) );
852 pStyle
= aIter
.Next();
856 return uno::Sequence
<OUString
>();
859 sal_Bool SAL_CALL
ScStyleFamilyObj::hasByName( const OUString
& aName
)
860 throw(uno::RuntimeException
)
862 SolarMutexGuard aGuard
;
865 OUString
aString(ScStyleNameConversion::ProgrammaticToDisplayName( aName
, sal::static_int_cast
<sal_uInt16
>(eFamily
) ));
867 ScDocument
* pDoc
= pDocShell
->GetDocument();
868 ScStyleSheetPool
* pStylePool
= pDoc
->GetStyleSheetPool();
869 if ( pStylePool
->Find( aString
, eFamily
) )
877 uno::Reference
< beans::XPropertySetInfo
> SAL_CALL
ScStyleFamilyObj::getPropertySetInfo( ) throw (uno::RuntimeException
)
879 OSL_FAIL( "###unexpected!" );
880 return uno::Reference
< beans::XPropertySetInfo
>();
883 void SAL_CALL
ScStyleFamilyObj::setPropertyValue( const OUString
&, const uno::Any
& ) throw (beans::UnknownPropertyException
, beans::PropertyVetoException
, lang::IllegalArgumentException
, lang::WrappedTargetException
, uno::RuntimeException
)
885 OSL_FAIL( "###unexpected!" );
888 uno::Any SAL_CALL
ScStyleFamilyObj::getPropertyValue( const OUString
& sPropertyName
) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
892 if ( sPropertyName
== "DisplayName" )
894 SolarMutexGuard aGuard
;
895 sal_uInt32 nResId
= 0;
898 case SFX_STYLE_FAMILY_PARA
:
899 nResId
= STR_STYLE_FAMILY_CELL
; break;
900 case SFX_STYLE_FAMILY_PAGE
:
901 nResId
= STR_STYLE_FAMILY_PAGE
; break;
903 OSL_FAIL( "ScStyleFamilyObj::getPropertyValue(): invalid family" );
907 OUString
sDisplayName( ScGlobal::GetRscString( static_cast< sal_uInt16
>( nResId
) ) );
908 aRet
= uno::makeAny( sDisplayName
);
913 throw beans::UnknownPropertyException( OUString( "unknown property: " ) + sPropertyName
, static_cast<OWeakObject
*>(this) );
919 void SAL_CALL
ScStyleFamilyObj::addPropertyChangeListener( const OUString
&, const uno::Reference
< beans::XPropertyChangeListener
>& ) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
921 OSL_FAIL( "###unexpected!" );
924 void SAL_CALL
ScStyleFamilyObj::removePropertyChangeListener( const OUString
&, const uno::Reference
< beans::XPropertyChangeListener
>& ) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
926 OSL_FAIL( "###unexpected!" );
929 void SAL_CALL
ScStyleFamilyObj::addVetoableChangeListener( const OUString
&, const uno::Reference
< beans::XVetoableChangeListener
>& ) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
931 OSL_FAIL( "###unexpected!" );
934 void SAL_CALL
ScStyleFamilyObj::removeVetoableChangeListener( const OUString
&, const uno::Reference
< beans::XVetoableChangeListener
>& ) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
936 OSL_FAIL( "###unexpected!" );
939 //------------------------------------------------------------------------
941 // Default-ctor wird fuer die Reflection gebraucht
943 ScStyleObj::ScStyleObj(ScDocShell
* pDocSh
, SfxStyleFamily eFam
, const OUString
& rName
) :
944 pPropSet( (eFam
== SFX_STYLE_FAMILY_PARA
) ? lcl_GetCellStyleSet() : lcl_GetPageStyleSet() ),
949 // pDocShell ist Null, wenn per ServiceProvider erzeugt
952 pDocShell
->GetDocument()->AddUnoObject(*this);
955 void ScStyleObj::InitDoc( ScDocShell
* pNewDocSh
, const OUString
& rNewName
)
957 if ( pNewDocSh
&& !pDocShell
)
959 aStyleName
= rNewName
;
960 pDocShell
= pNewDocSh
;
961 pDocShell
->GetDocument()->AddUnoObject(*this);
965 ScStyleObj::~ScStyleObj()
968 pDocShell
->GetDocument()->RemoveUnoObject(*this);
973 sal_Int64 SAL_CALL
ScStyleObj::getSomething(
974 const uno::Sequence
<sal_Int8
>& rId
) throw(uno::RuntimeException
)
976 if ( rId
.getLength() == 16 &&
977 0 == memcmp( getUnoTunnelId().getConstArray(),
978 rId
.getConstArray(), 16 ) )
980 return sal::static_int_cast
<sal_Int64
>(reinterpret_cast<sal_IntPtr
>(this));
987 class theScStyleObjUnoTunnelId
: public rtl::Static
< UnoTunnelIdInit
, theScStyleObjUnoTunnelId
> {};
990 const uno::Sequence
<sal_Int8
>& ScStyleObj::getUnoTunnelId()
992 return theScStyleObjUnoTunnelId::get().getSeq();
995 ScStyleObj
* ScStyleObj::getImplementation(
996 const uno::Reference
<uno::XInterface
> xObj
)
998 ScStyleObj
* pRet
= NULL
;
999 uno::Reference
<lang::XUnoTunnel
> xUT( xObj
, uno::UNO_QUERY
);
1001 pRet
= reinterpret_cast<ScStyleObj
*>(sal::static_int_cast
<sal_IntPtr
>(xUT
->getSomething(getUnoTunnelId())));
1005 void ScStyleObj::Notify( SfxBroadcaster
&, const SfxHint
& rHint
)
1007 // Referenz-Update interessiert hier nicht
1009 if ( rHint
.ISA( SfxSimpleHint
) &&
1010 ((const SfxSimpleHint
&)rHint
).GetId() == SFX_HINT_DYING
)
1012 pDocShell
= NULL
; // ungueltig geworden
1016 SfxStyleSheetBase
* ScStyleObj::GetStyle_Impl()
1020 ScDocument
* pDoc
= pDocShell
->GetDocument();
1021 ScStyleSheetPool
* pStylePool
= pDoc
->GetStyleSheetPool();
1022 return pStylePool
->Find( aStyleName
, eFamily
);
1029 sal_Bool SAL_CALL
ScStyleObj::isUserDefined() throw(uno::RuntimeException
)
1031 SolarMutexGuard aGuard
;
1032 SfxStyleSheetBase
* pStyle
= GetStyle_Impl();
1034 return pStyle
->IsUserDefined();
1038 sal_Bool SAL_CALL
ScStyleObj::isInUse() throw(uno::RuntimeException
)
1040 SolarMutexGuard aGuard
;
1041 SfxStyleSheetBase
* pStyle
= GetStyle_Impl();
1043 return pStyle
->IsUsed();
1047 OUString SAL_CALL
ScStyleObj::getParentStyle() throw(uno::RuntimeException
)
1049 SolarMutexGuard aGuard
;
1050 SfxStyleSheetBase
* pStyle
= GetStyle_Impl();
1052 return ScStyleNameConversion::DisplayToProgrammaticName( pStyle
->GetParent(), sal::static_int_cast
<sal_uInt16
>(eFamily
) );
1056 void SAL_CALL
ScStyleObj::setParentStyle( const OUString
& rParentStyle
)
1057 throw(container::NoSuchElementException
, uno::RuntimeException
)
1059 SolarMutexGuard aGuard
;
1060 SfxStyleSheetBase
* pStyle
= GetStyle_Impl();
1063 // cell styles cannot be modified if any sheet is protected
1064 if ( eFamily
== SFX_STYLE_FAMILY_PARA
&& lcl_AnyTabProtected( *pDocShell
->GetDocument() ) )
1065 return; //! exception?
1067 //! DocFunc-Funktion??
1068 //! Undo ?????????????
1070 OUString
aString(ScStyleNameConversion::ProgrammaticToDisplayName( rParentStyle
, sal::static_int_cast
<sal_uInt16
>(eFamily
) ));
1071 sal_Bool bOk
= pStyle
->SetParent( aString
);
1074 // wie bei setPropertyValue
1076 ScDocument
* pDoc
= pDocShell
->GetDocument();
1077 if ( eFamily
== SFX_STYLE_FAMILY_PARA
)
1079 // Zeilenhoehen anpassen...
1081 VirtualDevice aVDev
;
1082 Point aLogic
= aVDev
.LogicToPixel( Point(1000,1000), MAP_TWIP
);
1083 double nPPTX
= aLogic
.X() / 1000.0;
1084 double nPPTY
= aLogic
.Y() / 1000.0;
1085 Fraction
aZoom(1,1);
1086 pDoc
->StyleSheetChanged( pStyle
, false, &aVDev
, nPPTX
, nPPTY
, aZoom
, aZoom
);
1088 pDocShell
->PostPaint( 0,0,0, MAXCOL
,MAXROW
,MAXTAB
, PAINT_GRID
|PAINT_LEFT
);
1089 pDocShell
->SetDocumentModified();
1093 //! ModifyStyleSheet am Dokument (alte Werte merken)
1095 pDocShell
->PageStyleModified( aStyleName
, sal_True
);
1101 // container::XNamed
1103 OUString SAL_CALL
ScStyleObj::getName() throw(uno::RuntimeException
)
1105 SolarMutexGuard aGuard
;
1106 SfxStyleSheetBase
* pStyle
= GetStyle_Impl();
1108 return ScStyleNameConversion::DisplayToProgrammaticName( pStyle
->GetName(), sal::static_int_cast
<sal_uInt16
>(eFamily
) );
1112 void SAL_CALL
ScStyleObj::setName( const OUString
& aNewName
)
1113 throw(uno::RuntimeException
)
1115 SolarMutexGuard aGuard
;
1116 SfxStyleSheetBase
* pStyle
= GetStyle_Impl();
1119 // cell styles cannot be renamed if any sheet is protected
1120 if ( eFamily
== SFX_STYLE_FAMILY_PARA
&& lcl_AnyTabProtected( *pDocShell
->GetDocument() ) )
1121 return; //! exception?
1123 //! DocFunc-Funktion??
1124 //! Undo ?????????????
1126 OUString
aString(aNewName
);
1127 sal_Bool bOk
= pStyle
->SetName( aString
);
1130 aStyleName
= aString
; //! notify other objects for this style?
1132 ScDocument
* pDoc
= pDocShell
->GetDocument();
1133 if ( eFamily
== SFX_STYLE_FAMILY_PARA
&& !pDoc
->IsImportingXML() )
1134 pDoc
->GetPool()->CellStyleCreated( aString
);
1136 // Zellvorlagen = 2, Seitenvorlagen = 4
1137 sal_uInt16 nId
= ( eFamily
== SFX_STYLE_FAMILY_PARA
) ?
1138 SID_STYLE_FAMILY2
: SID_STYLE_FAMILY4
;
1139 SfxBindings
* pBindings
= pDocShell
->GetViewBindings();
1142 pBindings
->Invalidate( nId
);
1143 pBindings
->Invalidate( SID_STYLE_APPLY
);
1149 uno::Reference
<container::XIndexReplace
> ScStyleObj::CreateEmptyNumberingRules()
1151 SvxNumRule
aRule( 0, 0, sal_True
); // nothing supported
1152 return SvxCreateNumRule( &aRule
);
1155 // beans::XPropertyState
1157 const SfxItemSet
* ScStyleObj::GetStyleItemSet_Impl( const OUString
& rPropName
,
1158 const SfxItemPropertySimpleEntry
*& rpResultEntry
)
1160 //! OUString as argument?
1162 SfxStyleSheetBase
* pStyle
= GetStyle_Impl();
1165 const SfxItemPropertySimpleEntry
* pEntry
= NULL
;
1166 if ( eFamily
== SFX_STYLE_FAMILY_PAGE
)
1168 pEntry
= lcl_GetHeaderStyleMap()->getByName( rPropName
);
1169 if ( pEntry
) // only item-wids in header/footer map
1171 rpResultEntry
= pEntry
;
1172 return &((const SvxSetItem
&)pStyle
->GetItemSet().Get(ATTR_PAGE_HEADERSET
)).GetItemSet();
1174 pEntry
= lcl_GetFooterStyleMap()->getByName( rPropName
);
1175 if ( pEntry
) // only item-wids in header/footer map
1177 rpResultEntry
= pEntry
;
1178 return &((const SvxSetItem
&)pStyle
->GetItemSet().Get(ATTR_PAGE_FOOTERSET
)).GetItemSet();
1181 pEntry
= pPropSet
->getPropertyMap().getByName( rPropName
);
1184 rpResultEntry
= pEntry
;
1185 return &pStyle
->GetItemSet();
1189 rpResultEntry
= NULL
;
1193 beans::PropertyState SAL_CALL
ScStyleObj::getPropertyState( const OUString
& aPropertyName
)
1194 throw(beans::UnknownPropertyException
, uno::RuntimeException
)
1196 SolarMutexGuard aGuard
;
1197 beans::PropertyState eRet
= beans::PropertyState_DIRECT_VALUE
;
1199 const SfxItemPropertySimpleEntry
* pResultEntry
= NULL
;
1200 const SfxItemSet
* pItemSet
= GetStyleItemSet_Impl( aPropertyName
, pResultEntry
);
1202 if ( pItemSet
&& pResultEntry
)
1204 sal_uInt16 nWhich
= pResultEntry
->nWID
;
1205 if ( nWhich
== SC_WID_UNO_TBLBORD
|| nWhich
== SC_WID_UNO_TBLBORD2
)
1207 nWhich
= ATTR_BORDER
;
1209 if ( IsScItemWid( nWhich
) )
1211 SfxItemState eState
= pItemSet
->GetItemState( nWhich
, false );
1213 // // if no rotate value is set, look at orientation
1214 // //! also for a fixed value of 0 (in case orientation is ambiguous)?
1215 // if ( nWhich == ATTR_ROTATE_VALUE && eState == SFX_ITEM_DEFAULT )
1216 // eState = pItemSet->GetItemState( ATTR_ORIENTATION, sal_False );
1218 if ( eState
== SFX_ITEM_SET
)
1219 eRet
= beans::PropertyState_DIRECT_VALUE
;
1220 else if ( eState
== SFX_ITEM_DEFAULT
)
1221 eRet
= beans::PropertyState_DEFAULT_VALUE
;
1222 else if ( eState
== SFX_ITEM_DONTCARE
)
1223 eRet
= beans::PropertyState_AMBIGUOUS_VALUE
; // kann eigentlich nicht sein...
1226 OSL_FAIL("unbekannter ItemState");
1233 uno::Sequence
<beans::PropertyState
> SAL_CALL
ScStyleObj::getPropertyStates(
1234 const uno::Sequence
<OUString
>& aPropertyNames
)
1235 throw(beans::UnknownPropertyException
, uno::RuntimeException
)
1237 // duemmliche Default-Implementierung: alles einzeln per getPropertyState holen
1238 //! sollte optimiert werden!
1240 SolarMutexGuard aGuard
;
1241 const OUString
* pNames
= aPropertyNames
.getConstArray();
1242 uno::Sequence
<beans::PropertyState
> aRet(aPropertyNames
.getLength());
1243 beans::PropertyState
* pStates
= aRet
.getArray();
1244 for(sal_Int32 i
= 0; i
< aPropertyNames
.getLength(); i
++)
1245 pStates
[i
] = getPropertyState(pNames
[i
]);
1249 void SAL_CALL
ScStyleObj::setPropertyToDefault( const OUString
& aPropertyName
)
1250 throw(beans::UnknownPropertyException
, uno::RuntimeException
)
1252 SolarMutexGuard aGuard
;
1254 const SfxItemPropertyMap
& rMap
= pPropSet
->getPropertyMap();
1255 const SfxItemPropertySimpleEntry
* pEntry
= rMap
.getByName( aPropertyName
);
1257 throw beans::UnknownPropertyException();
1259 SetOnePropertyValue( aPropertyName
, pEntry
, NULL
);
1262 uno::Any SAL_CALL
ScStyleObj::getPropertyDefault( const OUString
& aPropertyName
)
1263 throw(beans::UnknownPropertyException
, lang::WrappedTargetException
,
1264 uno::RuntimeException
)
1266 SolarMutexGuard aGuard
;
1269 const SfxItemPropertySimpleEntry
* pResultEntry
= NULL
;
1270 const SfxItemSet
* pStyleSet
= GetStyleItemSet_Impl( aPropertyName
, pResultEntry
);
1272 if ( pStyleSet
&& pResultEntry
)
1274 sal_uInt16 nWhich
= pResultEntry
->nWID
;
1276 if ( IsScItemWid( nWhich
) )
1278 // Default ist Default vom ItemPool, nicht vom Standard-Style,
1279 // damit es zu setPropertyToDefault passt
1280 SfxItemSet
aEmptySet( *pStyleSet
->GetPool(), pStyleSet
->GetRanges() );
1281 // Default-Items mit falscher Slot-ID funktionieren im SfxItemPropertySet3 nicht
1282 //! Slot-IDs aendern...
1283 if ( aEmptySet
.GetPool()->GetSlotId(nWhich
) == nWhich
&&
1284 aEmptySet
.GetItemState(nWhich
, false) == SFX_ITEM_DEFAULT
)
1286 aEmptySet
.Put( aEmptySet
.Get( nWhich
) );
1288 const SfxItemSet
* pItemSet
= &aEmptySet
;
1290 switch ( nWhich
) // fuer Item-Spezial-Behandlungen
1292 case ATTR_VALUE_FORMAT
:
1293 // default has no language set
1294 aAny
<<= sal_Int32( ((const SfxUInt32Item
&)pItemSet
->Get(nWhich
)).GetValue() );
1297 aAny
<<= sal_Int16( TwipsToHMM(((const SfxUInt16Item
&)
1298 pItemSet
->Get(nWhich
)).GetValue()) );
1300 case ATTR_PAGE_SCALE
:
1301 case ATTR_PAGE_SCALETOPAGES
:
1302 case ATTR_PAGE_FIRSTPAGENO
:
1303 aAny
<<= sal_Int16( ((const SfxUInt16Item
&)pItemSet
->Get(nWhich
)).GetValue() );
1305 case ATTR_PAGE_CHARTS
:
1306 case ATTR_PAGE_OBJECTS
:
1307 case ATTR_PAGE_DRAWINGS
:
1308 //! sal_Bool-MID fuer ScViewObjectModeItem definieren?
1309 aAny
<<= sal_Bool( ((const ScViewObjectModeItem
&)pItemSet
->Get(nWhich
)).
1310 GetValue() == VOBJ_MODE_SHOW
);
1312 case ATTR_PAGE_SCALETO
:
1314 const ScPageScaleToItem
aItem((const ScPageScaleToItem
&)pItemSet
->Get(nWhich
));
1315 if ( aPropertyName
== SC_UNO_PAGE_SCALETOX
)
1316 aAny
= uno::makeAny(static_cast<sal_Int16
>(aItem
.GetWidth()));
1318 aAny
= uno::makeAny(static_cast<sal_Int16
>(aItem
.GetHeight()));
1322 pPropSet
->getPropertyValue( *pResultEntry
, *pItemSet
, aAny
);
1325 else if ( IsScUnoWid( nWhich
) )
1327 SfxItemSet
aEmptySet( *pStyleSet
->GetPool(), pStyleSet
->GetRanges() );
1328 const SfxItemSet
* pItemSet
= &aEmptySet
;
1331 case SC_WID_UNO_TBLBORD
:
1332 case SC_WID_UNO_TBLBORD2
:
1334 const SfxPoolItem
* pItem
= &pItemSet
->Get( ATTR_BORDER
);
1337 SvxBoxItem
aOuter( *( static_cast<const SvxBoxItem
*>( pItem
) ) );
1338 SvxBoxInfoItem
aInner( ATTR_BORDER_INNER
);
1339 if (nWhich
== SC_WID_UNO_TBLBORD2
)
1340 ScHelperFunctions::AssignTableBorder2ToAny( aAny
, aOuter
, aInner
, true);
1342 ScHelperFunctions::AssignTableBorderToAny( aAny
, aOuter
, aInner
, true);
1352 // XMultiPropertySet
1354 void SAL_CALL
ScStyleObj::setPropertyValues( const uno::Sequence
< OUString
>& aPropertyNames
,
1355 const uno::Sequence
< uno::Any
>& aValues
)
1356 throw (beans::PropertyVetoException
, lang::IllegalArgumentException
,
1357 lang::WrappedTargetException
, uno::RuntimeException
)
1359 SolarMutexGuard aGuard
;
1361 sal_Int32 nCount
= aPropertyNames
.getLength();
1362 if ( aValues
.getLength() != nCount
)
1363 throw lang::IllegalArgumentException();
1367 const OUString
* pNames
= aPropertyNames
.getConstArray();
1368 const uno::Any
* pValues
= aValues
.getConstArray();
1370 const SfxItemPropertyMap
& rPropertyMap
= pPropSet
->getPropertyMap();
1371 for (sal_Int32 i
= 0; i
< nCount
; i
++)
1373 const SfxItemPropertySimpleEntry
* pEntry
= rPropertyMap
.getByName( pNames
[i
] );
1374 SetOnePropertyValue( pNames
[i
], pEntry
, &pValues
[i
] );
1379 uno::Sequence
<uno::Any
> SAL_CALL
ScStyleObj::getPropertyValues(
1380 const uno::Sequence
< OUString
>& aPropertyNames
)
1381 throw (uno::RuntimeException
)
1383 SolarMutexGuard aGuard
;
1387 sal_Int32 nCount
= aPropertyNames
.getLength();
1388 uno::Sequence
<uno::Any
> aSequence( nCount
);
1391 uno::Any
* pValues
= aSequence
.getArray();
1392 for (sal_Int32 i
=0; i
<nCount
; i
++)
1393 pValues
[i
] = getPropertyValue( aPropertyNames
[i
] );
1398 void SAL_CALL
ScStyleObj::addPropertiesChangeListener( const uno::Sequence
<OUString
>& /* aPropertyNames */,
1399 const uno::Reference
<beans::XPropertiesChangeListener
>& /* xListener */ )
1400 throw (uno::RuntimeException
)
1402 // no bound properties
1405 void SAL_CALL
ScStyleObj::removePropertiesChangeListener(
1406 const uno::Reference
<beans::XPropertiesChangeListener
>& /* xListener */ )
1407 throw (uno::RuntimeException
)
1409 // no bound properties
1412 void SAL_CALL
ScStyleObj::firePropertiesChangeEvent( const uno::Sequence
<OUString
>& /* aPropertyNames */,
1413 const uno::Reference
<beans::XPropertiesChangeListener
>& /* xListener */ )
1414 throw (uno::RuntimeException
)
1416 // no bound properties
1419 // XMultiPropertyStates
1420 // getPropertyStates already defined for XPropertyState
1422 void SAL_CALL
ScStyleObj::setAllPropertiesToDefault() throw (uno::RuntimeException
)
1424 SolarMutexGuard aGuard
;
1426 SfxStyleSheetBase
* pStyle
= GetStyle_Impl();
1429 // cell styles cannot be modified if any sheet is protected
1430 if ( eFamily
== SFX_STYLE_FAMILY_PARA
&& lcl_AnyTabProtected( *pDocShell
->GetDocument() ) )
1431 throw uno::RuntimeException();
1433 SfxItemSet
& rSet
= pStyle
->GetItemSet();
1434 rSet
.ClearItem(); // set all items to default
1436 //! merge with SetOneProperty
1438 ScDocument
* pDoc
= pDocShell
->GetDocument();
1439 if ( eFamily
== SFX_STYLE_FAMILY_PARA
)
1443 VirtualDevice aVDev
;
1444 Point aLogic
= aVDev
.LogicToPixel( Point(1000,1000), MAP_TWIP
);
1445 double nPPTX
= aLogic
.X() / 1000.0;
1446 double nPPTY
= aLogic
.Y() / 1000.0;
1447 Fraction
aZoom(1,1);
1448 pDoc
->StyleSheetChanged( pStyle
, false, &aVDev
, nPPTX
, nPPTY
, aZoom
, aZoom
);
1450 pDocShell
->PostPaint( 0,0,0, MAXCOL
,MAXROW
,MAXTAB
, PAINT_GRID
|PAINT_LEFT
);
1451 pDocShell
->SetDocumentModified();
1455 // #i22448# apply the default BoxInfoItem for page styles again
1456 // (same content as in ScStyleSheet::GetItemSet, to control the dialog)
1457 SvxBoxInfoItem
aBoxInfoItem( ATTR_BORDER_INNER
);
1458 aBoxInfoItem
.SetTable( false );
1459 aBoxInfoItem
.SetDist( sal_True
);
1460 aBoxInfoItem
.SetValid( VALID_DISTANCE
, sal_True
);
1461 rSet
.Put( aBoxInfoItem
);
1463 pDocShell
->PageStyleModified( aStyleName
, sal_True
);
1468 void SAL_CALL
ScStyleObj::setPropertiesToDefault( const uno::Sequence
<OUString
>& aPropertyNames
)
1469 throw (beans::UnknownPropertyException
, uno::RuntimeException
)
1471 SolarMutexGuard aGuard
;
1473 sal_Int32 nCount
= aPropertyNames
.getLength();
1476 const OUString
* pNames
= aPropertyNames
.getConstArray();
1478 const SfxItemPropertyMap
& rPropertyMap
= pPropSet
->getPropertyMap();
1479 for (sal_Int32 i
= 0; i
< nCount
; i
++)
1481 const SfxItemPropertySimpleEntry
* pEntry
= rPropertyMap
.getByName( pNames
[i
] );
1482 SetOnePropertyValue( pNames
[i
], pEntry
, NULL
);
1487 uno::Sequence
<uno::Any
> SAL_CALL
ScStyleObj::getPropertyDefaults(
1488 const uno::Sequence
<OUString
>& aPropertyNames
)
1489 throw (beans::UnknownPropertyException
, lang::WrappedTargetException
,
1490 uno::RuntimeException
)
1492 SolarMutexGuard aGuard
;
1496 sal_Int32 nCount
= aPropertyNames
.getLength();
1497 uno::Sequence
<uno::Any
> aSequence( nCount
);
1500 uno::Any
* pValues
= aSequence
.getArray();
1501 for (sal_Int32 i
=0; i
<nCount
; i
++)
1502 pValues
[i
] = getPropertyDefault( aPropertyNames
[i
] );
1507 // beans::XPropertySet
1509 uno::Reference
<beans::XPropertySetInfo
> SAL_CALL
ScStyleObj::getPropertySetInfo()
1510 throw(uno::RuntimeException
)
1512 SolarMutexGuard aGuard
;
1513 return pPropSet
->getPropertySetInfo();
1516 void SAL_CALL
ScStyleObj::setPropertyValue(
1517 const OUString
& aPropertyName
, const uno::Any
& aValue
)
1518 throw(beans::UnknownPropertyException
, beans::PropertyVetoException
,
1519 lang::IllegalArgumentException
, lang::WrappedTargetException
,
1520 uno::RuntimeException
)
1522 SolarMutexGuard aGuard
;
1524 const SfxItemPropertySimpleEntry
* pEntry
= pPropSet
->getPropertyMap().getByName( aPropertyName
);
1526 throw beans::UnknownPropertyException();
1528 SetOnePropertyValue( aPropertyName
, pEntry
, &aValue
);
1531 void ScStyleObj::SetOnePropertyValue( const OUString
& rPropertyName
, const SfxItemPropertySimpleEntry
* pEntry
, const uno::Any
* pValue
)
1532 throw(lang::IllegalArgumentException
, uno::RuntimeException
)
1534 SfxStyleSheetBase
* pStyle
= GetStyle_Impl();
1535 if ( pStyle
&& pEntry
)
1537 // cell styles cannot be modified if any sheet is protected
1538 if ( eFamily
== SFX_STYLE_FAMILY_PARA
&& lcl_AnyTabProtected( *pDocShell
->GetDocument() ) )
1539 throw uno::RuntimeException();
1541 SfxItemSet
& rSet
= pStyle
->GetItemSet(); // direkt im lebenden Style aendern...
1543 if ( eFamily
== SFX_STYLE_FAMILY_PAGE
)
1545 if(pEntry
->nWID
== SC_WID_UNO_HEADERSET
)
1547 const SfxItemPropertySimpleEntry
* pHeaderEntry
= lcl_GetHeaderStyleMap()->getByName( rPropertyName
);
1548 if ( pHeaderEntry
) // only item-wids in header/footer map
1550 SvxSetItem
aNewHeader( (const SvxSetItem
&)rSet
.Get(ATTR_PAGE_HEADERSET
) );
1552 pPropSet
->setPropertyValue( *pHeaderEntry
, *pValue
, aNewHeader
.GetItemSet() );
1554 aNewHeader
.GetItemSet().ClearItem( pHeaderEntry
->nWID
);
1555 rSet
.Put( aNewHeader
);
1559 else if(pEntry
->nWID
== SC_WID_UNO_FOOTERSET
)
1561 const SfxItemPropertySimpleEntry
* pFooterEntry
= lcl_GetFooterStyleMap()->getByName( rPropertyName
);
1562 if ( pFooterEntry
) // only item-wids in header/footer map
1564 SvxSetItem
aNewFooter( (const SvxSetItem
&)rSet
.Get(ATTR_PAGE_FOOTERSET
) );
1566 pPropSet
->setPropertyValue( *pFooterEntry
, *pValue
, aNewFooter
.GetItemSet() );
1568 aNewFooter
.GetItemSet().ClearItem( pFooterEntry
->nWID
);
1569 rSet
.Put( aNewFooter
);
1578 if ( IsScItemWid( pEntry
->nWID
) )
1582 switch ( pEntry
->nWID
) // fuer Item-Spezial-Behandlungen
1584 case ATTR_VALUE_FORMAT
:
1586 // language for number formats
1587 SvNumberFormatter
* pFormatter
=
1588 pDocShell
->GetDocument()->GetFormatTable();
1589 sal_uInt32 nOldFormat
= ((const SfxUInt32Item
&)
1590 rSet
.Get( ATTR_VALUE_FORMAT
)).GetValue();
1591 LanguageType eOldLang
= ((const SvxLanguageItem
&)
1592 rSet
.Get( ATTR_LANGUAGE_FORMAT
)).GetLanguage();
1593 nOldFormat
= pFormatter
->
1594 GetFormatForLanguageIfBuiltIn( nOldFormat
, eOldLang
);
1596 sal_uInt32 nNewFormat
= 0;
1597 *pValue
>>= nNewFormat
;
1598 rSet
.Put( SfxUInt32Item( ATTR_VALUE_FORMAT
, nNewFormat
) );
1600 const SvNumberformat
* pNewEntry
= pFormatter
->GetEntry( nNewFormat
);
1601 LanguageType eNewLang
=
1602 pNewEntry
? pNewEntry
->GetLanguage() : LANGUAGE_DONTKNOW
;
1603 if ( eNewLang
!= eOldLang
&& eNewLang
!= LANGUAGE_DONTKNOW
)
1604 rSet
.Put( SvxLanguageItem( eNewLang
, ATTR_LANGUAGE_FORMAT
) );
1606 //! keep default state of number format if only language changed?
1613 rSet
.Put( SfxUInt16Item( pEntry
->nWID
, (sal_uInt16
)HMMToTwips(nVal
) ) );
1616 case ATTR_ROTATE_VALUE
:
1618 sal_Int32 nRotVal
= 0;
1619 if ( *pValue
>>= nRotVal
)
1621 // stored value is always between 0 and 360 deg.
1625 rSet
.Put( SfxInt32Item( ATTR_ROTATE_VALUE
, nRotVal
) );
1631 table::CellOrientation eOrient
;
1632 if( *pValue
>>= eOrient
)
1636 case table::CellOrientation_STANDARD
:
1637 rSet
.Put( SfxBoolItem( ATTR_STACKED
, false ) );
1639 case table::CellOrientation_TOPBOTTOM
:
1640 rSet
.Put( SfxBoolItem( ATTR_STACKED
, false ) );
1641 rSet
.Put( SfxInt32Item( ATTR_ROTATE_VALUE
, 27000 ) );
1643 case table::CellOrientation_BOTTOMTOP
:
1644 rSet
.Put( SfxBoolItem( ATTR_STACKED
, false ) );
1645 rSet
.Put( SfxInt32Item( ATTR_ROTATE_VALUE
, 9000 ) );
1647 case table::CellOrientation_STACKED
:
1648 rSet
.Put( SfxBoolItem( ATTR_STACKED
, sal_True
) );
1652 // added to avoid warnings
1658 case ATTR_PAGE_SCALE
:
1659 case ATTR_PAGE_SCALETOPAGES
:
1661 rSet
.ClearItem(ATTR_PAGE_SCALETOPAGES
);
1662 rSet
.ClearItem(ATTR_PAGE_SCALE
);
1663 rSet
.ClearItem(ATTR_PAGE_SCALETO
);
1666 rSet
.Put( SfxUInt16Item( pEntry
->nWID
, nVal
) );
1669 case ATTR_PAGE_FIRSTPAGENO
:
1673 rSet
.Put( SfxUInt16Item( ATTR_PAGE_FIRSTPAGENO
, nVal
) );
1676 case ATTR_PAGE_CHARTS
:
1677 case ATTR_PAGE_OBJECTS
:
1678 case ATTR_PAGE_DRAWINGS
:
1680 sal_Bool bBool
= false;
1682 //! sal_Bool-MID fuer ScViewObjectModeItem definieren?
1683 rSet
.Put( ScViewObjectModeItem( pEntry
->nWID
,
1684 bBool
? VOBJ_MODE_SHOW
: VOBJ_MODE_HIDE
) );
1687 case ATTR_PAGE_PAPERBIN
:
1689 sal_uInt8 nTray
= PAPERBIN_PRINTER_SETTINGS
;
1690 bool bFound
= false;
1693 if ( *pValue
>>= aName
)
1695 if ( aName
== SC_PAPERBIN_DEFAULTNAME
)
1699 Printer
* pPrinter
= pDocShell
->GetPrinter();
1702 sal_uInt16 nCount
= pPrinter
->GetPaperBinCount();
1703 for (sal_uInt16 i
=0; i
<nCount
; i
++)
1704 if ( aName
== pPrinter
->GetPaperBinName(i
) )
1706 nTray
= (sal_uInt8
) i
;
1714 rSet
.Put( SvxPaperBinItem( ATTR_PAGE_PAPERBIN
, nTray
) );
1716 throw lang::IllegalArgumentException();
1719 case ATTR_PAGE_SCALETO
:
1721 sal_Int16 nPages
= 0;
1722 if (*pValue
>>= nPages
)
1724 ScPageScaleToItem aItem
= ((const ScPageScaleToItem
&)rSet
.Get(ATTR_PAGE_SCALETO
));
1725 if ( rPropertyName
== SC_UNO_PAGE_SCALETOX
)
1726 aItem
.SetWidth(static_cast<sal_uInt16
>(nPages
));
1728 aItem
.SetHeight(static_cast<sal_uInt16
>(nPages
));
1730 rSet
.ClearItem(ATTR_PAGE_SCALETOPAGES
);
1731 rSet
.ClearItem(ATTR_PAGE_SCALE
);
1737 sal_Bool bHidden
= sal_False
;
1738 if ( *pValue
>>= bHidden
)
1739 pStyle
->SetHidden( bHidden
);
1743 // Default-Items mit falscher Slot-ID
1744 // funktionieren im SfxItemPropertySet3 nicht
1745 //! Slot-IDs aendern...
1746 if ( rSet
.GetPool()->GetSlotId(pEntry
->nWID
) == pEntry
->nWID
&&
1747 rSet
.GetItemState(pEntry
->nWID
, false) == SFX_ITEM_DEFAULT
)
1749 rSet
.Put( rSet
.Get(pEntry
->nWID
) );
1751 pPropSet
->setPropertyValue( *pEntry
, *pValue
, rSet
);
1756 rSet
.ClearItem( pEntry
->nWID
);
1757 // language for number formats
1758 if ( pEntry
->nWID
== ATTR_VALUE_FORMAT
)
1759 rSet
.ClearItem( ATTR_LANGUAGE_FORMAT
);
1761 //! for ATTR_ROTATE_VALUE, also reset ATTR_ORIENTATION?
1764 else if ( IsScUnoWid( pEntry
->nWID
) )
1766 switch ( pEntry
->nWID
)
1768 case SC_WID_UNO_TBLBORD
:
1772 table::TableBorder aBorder
;
1773 if ( *pValue
>>= aBorder
)
1775 SvxBoxItem
aOuter( ATTR_BORDER
);
1776 SvxBoxInfoItem
aInner( ATTR_BORDER_INNER
);
1777 ScHelperFunctions::FillBoxItems( aOuter
, aInner
, aBorder
);
1783 rSet
.ClearItem( ATTR_BORDER
);
1787 case SC_WID_UNO_TBLBORD2
:
1791 table::TableBorder2 aBorder2
;
1792 if ( *pValue
>>= aBorder2
)
1794 SvxBoxItem
aOuter( ATTR_BORDER
);
1795 SvxBoxInfoItem
aInner( ATTR_BORDER_INNER
);
1796 ScHelperFunctions::FillBoxItems( aOuter
, aInner
, aBorder2
);
1802 rSet
.ClearItem( ATTR_BORDER
);
1811 //! DocFunc-Funktion??
1812 //! Undo ?????????????
1814 ScDocument
* pDoc
= pDocShell
->GetDocument();
1815 if ( eFamily
== SFX_STYLE_FAMILY_PARA
)
1817 // Zeilenhoehen anpassen...
1819 VirtualDevice aVDev
;
1820 Point aLogic
= aVDev
.LogicToPixel( Point(1000,1000), MAP_TWIP
);
1821 double nPPTX
= aLogic
.X() / 1000.0;
1822 double nPPTY
= aLogic
.Y() / 1000.0;
1823 Fraction
aZoom(1,1);
1824 pDoc
->StyleSheetChanged( pStyle
, false, &aVDev
, nPPTX
, nPPTY
, aZoom
, aZoom
);
1826 pDocShell
->PostPaint( 0,0,0, MAXCOL
,MAXROW
,MAXTAB
, PAINT_GRID
|PAINT_LEFT
);
1827 pDocShell
->SetDocumentModified();
1831 //! ModifyStyleSheet am Dokument (alte Werte merken)
1833 pDocShell
->PageStyleModified( aStyleName
, sal_True
);
1838 uno::Any SAL_CALL
ScStyleObj::getPropertyValue( const OUString
& aPropertyName
)
1839 throw(beans::UnknownPropertyException
, lang::WrappedTargetException
,
1840 uno::RuntimeException
)
1842 SolarMutexGuard aGuard
;
1845 if ( aPropertyName
== SC_UNONAME_DISPNAME
) // read-only
1847 // core always has the display name
1848 SfxStyleSheetBase
* pStyle
= GetStyle_Impl();
1850 aAny
<<= OUString( pStyle
->GetName() );
1854 const SfxItemPropertySimpleEntry
* pResultEntry
= NULL
;
1855 const SfxItemSet
* pItemSet
= GetStyleItemSet_Impl( aPropertyName
, pResultEntry
);
1857 if ( pItemSet
&& pResultEntry
)
1859 sal_uInt16 nWhich
= pResultEntry
->nWID
;
1861 if ( IsScItemWid( nWhich
) )
1863 switch ( nWhich
) // fuer Item-Spezial-Behandlungen
1865 case ATTR_VALUE_FORMAT
:
1868 sal_uInt32 nOldFormat
= ((const SfxUInt32Item
&)
1869 pItemSet
->Get( ATTR_VALUE_FORMAT
)).GetValue();
1870 LanguageType eOldLang
= ((const SvxLanguageItem
&)
1871 pItemSet
->Get( ATTR_LANGUAGE_FORMAT
)).GetLanguage();
1872 nOldFormat
= pDocShell
->GetDocument()->GetFormatTable()->
1873 GetFormatForLanguageIfBuiltIn( nOldFormat
, eOldLang
);
1874 aAny
<<= nOldFormat
;
1878 aAny
<<= sal_Int16( TwipsToHMM(((const SfxUInt16Item
&)
1879 pItemSet
->Get(nWhich
)).GetValue()) );
1883 sal_Int32 nRot
= ((const SfxInt32Item
&)pItemSet
->Get(ATTR_ROTATE_VALUE
)).GetValue();
1884 sal_Bool bStacked
= ((const SfxBoolItem
&)pItemSet
->Get(nWhich
)).GetValue();
1885 SvxOrientationItem( nRot
, bStacked
, 0 ).QueryValue( aAny
);
1888 case ATTR_PAGE_SCALE
:
1889 case ATTR_PAGE_SCALETOPAGES
:
1890 case ATTR_PAGE_FIRSTPAGENO
:
1891 aAny
<<= sal_Int16( ((const SfxUInt16Item
&)pItemSet
->Get(nWhich
)).GetValue() );
1893 case ATTR_PAGE_CHARTS
:
1894 case ATTR_PAGE_OBJECTS
:
1895 case ATTR_PAGE_DRAWINGS
:
1896 //! sal_Bool-MID fuer ScViewObjectModeItem definieren?
1897 aAny
<<= sal_Bool( ((const ScViewObjectModeItem
&)pItemSet
->
1898 Get(nWhich
)).GetValue() == VOBJ_MODE_SHOW
);
1900 case ATTR_PAGE_PAPERBIN
:
1902 // property PrinterPaperTray is the name of the tray
1904 sal_uInt8 nValue
= ((const SvxPaperBinItem
&)pItemSet
->Get(nWhich
)).GetValue();
1906 if ( nValue
== PAPERBIN_PRINTER_SETTINGS
)
1907 aName
= OUString(SC_PAPERBIN_DEFAULTNAME
);
1910 Printer
* pPrinter
= pDocShell
->GetPrinter();
1912 aName
= pPrinter
->GetPaperBinName( nValue
);
1917 case ATTR_PAGE_SCALETO
:
1919 ScPageScaleToItem
aItem((const ScPageScaleToItem
&)pItemSet
->Get(ATTR_PAGE_SCALETO
));
1920 if ( aPropertyName
== SC_UNO_PAGE_SCALETOX
)
1921 aAny
= uno::makeAny(static_cast<sal_Int16
>(aItem
.GetWidth()));
1923 aAny
= uno::makeAny(static_cast<sal_Int16
>(aItem
.GetHeight()));
1928 sal_Bool bHidden
= sal_False
;
1929 SfxStyleSheetBase
* pStyle
= GetStyle_Impl();
1931 bHidden
= pStyle
->IsHidden();
1932 aAny
= uno::makeAny( bHidden
);
1936 // Default-Items mit falscher Slot-ID
1937 // funktionieren im SfxItemPropertySet3 nicht
1938 //! Slot-IDs aendern...
1939 if ( pItemSet
->GetPool()->GetSlotId(nWhich
) == nWhich
&&
1940 pItemSet
->GetItemState(nWhich
, false) == SFX_ITEM_DEFAULT
)
1942 SfxItemSet
aNoEmptySet( *pItemSet
);
1943 aNoEmptySet
.Put( aNoEmptySet
.Get( nWhich
) );
1944 pPropSet
->getPropertyValue( *pResultEntry
, aNoEmptySet
, aAny
);
1947 pPropSet
->getPropertyValue( *pResultEntry
, *pItemSet
, aAny
);
1950 else if ( IsScUnoWid( nWhich
) )
1954 case SC_WID_UNO_TBLBORD
:
1955 case SC_WID_UNO_TBLBORD2
:
1957 const SfxPoolItem
* pItem
= &pItemSet
->Get( ATTR_BORDER
);
1960 SvxBoxItem
aOuter( *( static_cast<const SvxBoxItem
*>( pItem
) ) );
1961 SvxBoxInfoItem
aInner( ATTR_BORDER_INNER
);
1962 if (nWhich
== SC_WID_UNO_TBLBORD2
)
1963 ScHelperFunctions::AssignTableBorder2ToAny( aAny
, aOuter
, aInner
, true);
1965 ScHelperFunctions::AssignTableBorderToAny( aAny
, aOuter
, aInner
, true);
1977 SC_IMPL_DUMMY_PROPERTY_LISTENER( ScStyleObj
)
1979 // lang::XServiceInfo
1981 OUString SAL_CALL
ScStyleObj::getImplementationName() throw(uno::RuntimeException
)
1983 return OUString("ScStyleObj" );
1986 sal_Bool SAL_CALL
ScStyleObj::supportsService( const OUString
& rServiceName
)
1987 throw(uno::RuntimeException
)
1989 bool bPage
= ( eFamily
== SFX_STYLE_FAMILY_PAGE
);
1990 return rServiceName
== SCSTYLE_SERVICE
||
1991 ( bPage
? rServiceName
== SCPAGESTYLE_SERVICE
: rServiceName
== SCCELLSTYLE_SERVICE
);
1994 uno::Sequence
<OUString
> SAL_CALL
ScStyleObj::getSupportedServiceNames()
1995 throw(uno::RuntimeException
)
1997 bool bPage
= ( eFamily
== SFX_STYLE_FAMILY_PAGE
);
1998 uno::Sequence
<OUString
> aRet(2);
1999 OUString
* pArray
= aRet
.getArray();
2000 pArray
[0] = OUString(SCSTYLE_SERVICE
);
2001 pArray
[1] = bPage
? OUString(SCPAGESTYLE_SERVICE
)
2002 : OUString(SCCELLSTYLE_SERVICE
);
2006 //------------------------------------------------------------------------
2009 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */