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>
53 #include <cppuhelper/supportsservice.hxx>
55 #include "styleuno.hxx"
58 #include "stlpool.hxx"
59 #include "docpool.hxx"
60 #include "miscuno.hxx"
61 #include "convuno.hxx"
62 #include "tablink.hxx"
63 #include "unonames.hxx"
64 #include "unowids.hxx"
65 #include "globstr.hrc"
66 #include "cellsuno.hxx"
67 #include "stylehelper.hxx"
69 using namespace ::com::sun::star
;
71 static const SfxItemPropertySet
* lcl_GetCellStyleSet()
73 static const SfxItemPropertyMapEntry aCellStyleMap_Impl
[] =
75 {OUString(SC_UNONAME_ASIANVERT
),ATTR_VERTICAL_ASIAN
,cppu::UnoType
<bool>::get(), 0, 0 },
76 {OUString(SC_UNONAME_BOTTBORDER
),ATTR_BORDER
, ::cppu::UnoType
<table::BorderLine
>::get(), 0, BOTTOM_BORDER
| CONVERT_TWIPS
},
77 {OUString(SC_UNONAME_BOTTBORDER2
),ATTR_BORDER
, ::cppu::UnoType
<table::BorderLine2
>::get(), 0, BOTTOM_BORDER
| CONVERT_TWIPS
},
78 {OUString(SC_UNONAME_CELLBACK
), ATTR_BACKGROUND
, ::cppu::UnoType
<sal_Int32
>::get(), 0, MID_BACK_COLOR
},
79 {OUString(SC_UNONAME_CELLPRO
), ATTR_PROTECTION
, ::cppu::UnoType
<util::CellProtection
>::get(), 0, 0 },
80 {OUString(SC_UNONAME_CCOLOR
), ATTR_FONT_COLOR
, ::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
81 {OUString(SC_UNONAME_COUTL
), ATTR_FONT_CONTOUR
, cppu::UnoType
<bool>::get(), 0, 0 },
82 {OUString(SC_UNONAME_CCROSS
), ATTR_FONT_CROSSEDOUT
,cppu::UnoType
<bool>::get(), 0, MID_CROSSED_OUT
},
83 {OUString(SC_UNONAME_CEMPHAS
), ATTR_FONT_EMPHASISMARK
,cppu::UnoType
<sal_Int16
>::get(), 0, MID_EMPHASIS
},
84 {OUString(SC_UNONAME_CFONT
), ATTR_FONT
, ::cppu::UnoType
<sal_Int16
>::get(), 0, MID_FONT_FAMILY
},
85 {OUString(SC_UNONAME_CFCHARS
), ATTR_FONT
, cppu::UnoType
<sal_Int16
>::get(), 0, MID_FONT_CHAR_SET
},
86 {OUString(SC_UNO_CJK_CFCHARS
), ATTR_CJK_FONT
, cppu::UnoType
<sal_Int16
>::get(), 0, MID_FONT_CHAR_SET
},
87 {OUString(SC_UNO_CTL_CFCHARS
), ATTR_CTL_FONT
, cppu::UnoType
<sal_Int16
>::get(), 0, MID_FONT_CHAR_SET
},
88 {OUString(SC_UNONAME_CFFAMIL
), ATTR_FONT
, cppu::UnoType
<sal_Int16
>::get(), 0, MID_FONT_FAMILY
},
89 {OUString(SC_UNO_CJK_CFFAMIL
), ATTR_CJK_FONT
, cppu::UnoType
<sal_Int16
>::get(), 0, MID_FONT_FAMILY
},
90 {OUString(SC_UNO_CTL_CFFAMIL
), ATTR_CTL_FONT
, cppu::UnoType
<sal_Int16
>::get(), 0, MID_FONT_FAMILY
},
91 {OUString(SC_UNONAME_CFNAME
), ATTR_FONT
, cppu::UnoType
<OUString
>::get(), 0, MID_FONT_FAMILY_NAME
},
92 {OUString(SC_UNO_CJK_CFNAME
), ATTR_CJK_FONT
, cppu::UnoType
<OUString
>::get(), 0, MID_FONT_FAMILY_NAME
},
93 {OUString(SC_UNO_CTL_CFNAME
), ATTR_CTL_FONT
, cppu::UnoType
<OUString
>::get(), 0, MID_FONT_FAMILY_NAME
},
94 {OUString(SC_UNONAME_CFPITCH
), ATTR_FONT
, cppu::UnoType
<sal_Int16
>::get(), 0, MID_FONT_PITCH
},
95 {OUString(SC_UNO_CJK_CFPITCH
), ATTR_CJK_FONT
, cppu::UnoType
<sal_Int16
>::get(), 0, MID_FONT_PITCH
},
96 {OUString(SC_UNO_CTL_CFPITCH
), ATTR_CTL_FONT
, cppu::UnoType
<sal_Int16
>::get(), 0, MID_FONT_PITCH
},
97 {OUString(SC_UNONAME_CFSTYLE
), ATTR_FONT
, cppu::UnoType
<OUString
>::get(), 0, MID_FONT_STYLE_NAME
},
98 {OUString(SC_UNO_CJK_CFSTYLE
), ATTR_CJK_FONT
, cppu::UnoType
<OUString
>::get(), 0, MID_FONT_STYLE_NAME
},
99 {OUString(SC_UNO_CTL_CFSTYLE
), ATTR_CTL_FONT
, cppu::UnoType
<OUString
>::get(), 0, MID_FONT_STYLE_NAME
},
100 {OUString(SC_UNONAME_CHEIGHT
), ATTR_FONT_HEIGHT
, ::cppu::UnoType
<float>::get(), 0, MID_FONTHEIGHT
| CONVERT_TWIPS
},
101 {OUString(SC_UNO_CJK_CHEIGHT
), ATTR_CJK_FONT_HEIGHT
,::cppu::UnoType
<float>::get(), 0, MID_FONTHEIGHT
| CONVERT_TWIPS
},
102 {OUString(SC_UNO_CTL_CHEIGHT
), ATTR_CTL_FONT_HEIGHT
,::cppu::UnoType
<float>::get(), 0, MID_FONTHEIGHT
| CONVERT_TWIPS
},
103 {OUString(SC_UNONAME_CLOCAL
), ATTR_FONT_LANGUAGE
, ::cppu::UnoType
<lang::Locale
>::get(), 0, MID_LANG_LOCALE
},
104 {OUString(SC_UNO_CJK_CLOCAL
), ATTR_CJK_FONT_LANGUAGE
,::cppu::UnoType
<lang::Locale
>::get(), 0, MID_LANG_LOCALE
},
105 {OUString(SC_UNO_CTL_CLOCAL
), ATTR_CTL_FONT_LANGUAGE
,::cppu::UnoType
<lang::Locale
>::get(), 0, MID_LANG_LOCALE
},
106 {OUString(SC_UNONAME_COVER
), ATTR_FONT_OVERLINE
, ::cppu::UnoType
<sal_Int16
>::get(), 0, MID_TL_STYLE
},
107 {OUString(SC_UNONAME_COVRLCOL
), ATTR_FONT_OVERLINE
, cppu::UnoType
<sal_Int32
>::get(), 0, MID_TL_COLOR
},
108 {OUString(SC_UNONAME_COVRLHAS
), ATTR_FONT_OVERLINE
, cppu::UnoType
<bool>::get(), 0, MID_TL_HASCOLOR
},
109 {OUString(SC_UNONAME_CPOST
), ATTR_FONT_POSTURE
, ::cppu::UnoType
<awt::FontSlant
>::get(), 0, MID_POSTURE
},
110 {OUString(SC_UNO_CJK_CPOST
), ATTR_CJK_FONT_POSTURE
,::cppu::UnoType
<awt::FontSlant
>::get(), 0, MID_POSTURE
},
111 {OUString(SC_UNO_CTL_CPOST
), ATTR_CTL_FONT_POSTURE
,::cppu::UnoType
<awt::FontSlant
>::get(), 0, MID_POSTURE
},
112 {OUString(SC_UNONAME_CRELIEF
), ATTR_FONT_RELIEF
, cppu::UnoType
<sal_Int16
>::get(), 0, MID_RELIEF
},
113 {OUString(SC_UNONAME_CSHADD
), ATTR_FONT_SHADOWED
, cppu::UnoType
<bool>::get(), 0, 0 },
114 {OUString(SC_UNONAME_CSTRIKE
), ATTR_FONT_CROSSEDOUT
,cppu::UnoType
<sal_Int16
>::get(), 0, MID_CROSS_OUT
},
115 {OUString(SC_UNONAME_CUNDER
), ATTR_FONT_UNDERLINE
,::cppu::UnoType
<sal_Int16
>::get(), 0, MID_TL_STYLE
},
116 {OUString(SC_UNONAME_CUNDLCOL
), ATTR_FONT_UNDERLINE
,cppu::UnoType
<sal_Int32
>::get(), 0, MID_TL_COLOR
},
117 {OUString(SC_UNONAME_CUNDLHAS
), ATTR_FONT_UNDERLINE
,cppu::UnoType
<bool>::get(), 0, MID_TL_HASCOLOR
},
118 {OUString(SC_UNONAME_CWEIGHT
), ATTR_FONT_WEIGHT
, ::cppu::UnoType
<float>::get(), 0, MID_WEIGHT
},
119 {OUString(SC_UNO_CJK_CWEIGHT
), ATTR_CJK_FONT_WEIGHT
,::cppu::UnoType
<float>::get(), 0, MID_WEIGHT
},
120 {OUString(SC_UNO_CTL_CWEIGHT
), ATTR_CTL_FONT_WEIGHT
,::cppu::UnoType
<float>::get(), 0, MID_WEIGHT
},
121 {OUString(SC_UNONAME_CWORDMOD
), ATTR_FONT_WORDLINE
, cppu::UnoType
<bool>::get(), 0, 0 },
122 {OUString(SC_UNONAME_DIAGONAL_BLTR
), ATTR_BORDER_BLTR
, ::cppu::UnoType
<table::BorderLine
>::get(), 0, 0 | CONVERT_TWIPS
},
123 {OUString(SC_UNONAME_DIAGONAL_BLTR2
), ATTR_BORDER_BLTR
, ::cppu::UnoType
<table::BorderLine2
>::get(), 0, 0 | CONVERT_TWIPS
},
124 {OUString(SC_UNONAME_DIAGONAL_TLBR
), ATTR_BORDER_TLBR
, ::cppu::UnoType
<table::BorderLine
>::get(), 0, 0 | CONVERT_TWIPS
},
125 {OUString(SC_UNONAME_DIAGONAL_TLBR2
), ATTR_BORDER_TLBR
, ::cppu::UnoType
<table::BorderLine2
>::get(), 0, 0 | CONVERT_TWIPS
},
126 {OUString(SC_UNONAME_DISPNAME
), SC_WID_UNO_DISPNAME
,::cppu::UnoType
<OUString
>::get(), beans::PropertyAttribute::READONLY
, 0 },
127 {OUString(SC_UNONAME_CELLHJUS
), ATTR_HOR_JUSTIFY
, ::cppu::UnoType
<table::CellHoriJustify
>::get(), 0, MID_HORJUST_HORJUST
},
128 {OUString(SC_UNONAME_CELLHJUS_METHOD
), ATTR_HOR_JUSTIFY_METHOD
, ::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
129 {OUString(SC_UNONAME_CELLTRAN
), ATTR_BACKGROUND
, cppu::UnoType
<bool>::get(), 0, MID_GRAPHIC_TRANSPARENT
},
130 {OUString(SC_UNONAME_WRAP
), ATTR_LINEBREAK
, cppu::UnoType
<bool>::get(), 0, 0 },
131 {OUString(SC_UNONAME_LEFTBORDER
),ATTR_BORDER
, ::cppu::UnoType
<table::BorderLine
>::get(), 0, LEFT_BORDER
| CONVERT_TWIPS
},
132 {OUString(SC_UNONAME_LEFTBORDER2
),ATTR_BORDER
, ::cppu::UnoType
<table::BorderLine2
>::get(), 0, LEFT_BORDER
| CONVERT_TWIPS
},
133 {OUString(SC_UNONAME_NUMFMT
), ATTR_VALUE_FORMAT
, ::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
134 // {SC_UNONAME_NUMRULES, SC_WID_UNO_NUMRULES,cppu::UnoType<container::XIndexReplace>::get(), 0, 0 },
135 {OUString(SC_UNONAME_CELLORI
), ATTR_STACKED
, ::cppu::UnoType
<table::CellOrientation
>::get(), 0, 0 },
136 {OUString(SC_UNONAME_PADJUST
), ATTR_HOR_JUSTIFY
, ::cppu::UnoType
<sal_Int16
>::get(), 0, MID_HORJUST_ADJUST
},
137 {OUString(SC_UNONAME_PBMARGIN
), ATTR_MARGIN
, ::cppu::UnoType
<sal_Int32
>::get(), 0, MID_MARGIN_LO_MARGIN
| CONVERT_TWIPS
},
138 {OUString(SC_UNONAME_PINDENT
), ATTR_INDENT
, ::cppu::UnoType
<sal_Int16
>::get(), 0, 0 }, //! CONVERT_TWIPS
139 {OUString(SC_UNONAME_PISCHDIST
),ATTR_SCRIPTSPACE
, cppu::UnoType
<bool>::get(), 0, 0 },
140 {OUString(SC_UNONAME_PISFORBID
),ATTR_FORBIDDEN_RULES
,cppu::UnoType
<bool>::get(), 0, 0 },
141 {OUString(SC_UNONAME_PISHANG
), ATTR_HANGPUNCTUATION
,cppu::UnoType
<bool>::get(), 0, 0 },
142 {OUString(SC_UNONAME_PISHYPHEN
),ATTR_HYPHENATE
, cppu::UnoType
<bool>::get(), 0, 0 },
143 {OUString(SC_UNONAME_PLASTADJ
), ATTR_HOR_JUSTIFY
, ::cppu::UnoType
<sal_Int16
>::get(), 0, MID_HORJUST_ADJUST
},
144 {OUString(SC_UNONAME_PLMARGIN
), ATTR_MARGIN
, ::cppu::UnoType
<sal_Int32
>::get(), 0, MID_MARGIN_L_MARGIN
| CONVERT_TWIPS
},
145 {OUString(SC_UNONAME_PRMARGIN
), ATTR_MARGIN
, ::cppu::UnoType
<sal_Int32
>::get(), 0, MID_MARGIN_R_MARGIN
| CONVERT_TWIPS
},
146 {OUString(SC_UNONAME_PTMARGIN
), ATTR_MARGIN
, ::cppu::UnoType
<sal_Int32
>::get(), 0, MID_MARGIN_UP_MARGIN
| CONVERT_TWIPS
},
147 {OUString(SC_UNONAME_RIGHTBORDER
),ATTR_BORDER
, ::cppu::UnoType
<table::BorderLine
>::get(), 0, RIGHT_BORDER
| CONVERT_TWIPS
},
148 {OUString(SC_UNONAME_RIGHTBORDER2
),ATTR_BORDER
, ::cppu::UnoType
<table::BorderLine2
>::get(), 0, RIGHT_BORDER
| CONVERT_TWIPS
},
149 {OUString(SC_UNONAME_ROTANG
), ATTR_ROTATE_VALUE
, ::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
150 {OUString(SC_UNONAME_ROTREF
), ATTR_ROTATE_MODE
, ::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
151 {OUString(SC_UNONAME_SHADOW
), ATTR_SHADOW
, ::cppu::UnoType
<table::ShadowFormat
>::get(), 0, 0 | CONVERT_TWIPS
},
152 {OUString(SC_UNONAME_SHRINK_TO_FIT
), ATTR_SHRINKTOFIT
, cppu::UnoType
<bool>::get(), 0, 0 },
153 {OUString(SC_UNONAME_TBLBORD
), SC_WID_UNO_TBLBORD
, ::cppu::UnoType
<table::TableBorder
>::get(), 0, 0 | CONVERT_TWIPS
},
154 {OUString(SC_UNONAME_TBLBORD
), SC_WID_UNO_TBLBORD2
, ::cppu::UnoType
<table::TableBorder2
>::get(), 0, 0 | CONVERT_TWIPS
},
155 {OUString(SC_UNONAME_TOPBORDER
),ATTR_BORDER
, ::cppu::UnoType
<table::BorderLine
>::get(), 0, TOP_BORDER
| CONVERT_TWIPS
},
156 {OUString(SC_UNONAME_TOPBORDER2
),ATTR_BORDER
, ::cppu::UnoType
<table::BorderLine2
>::get(), 0, TOP_BORDER
| CONVERT_TWIPS
},
157 {OUString(SC_UNONAME_USERDEF
), ATTR_USERDEF
, cppu::UnoType
<container::XNameContainer
>::get(), 0, 0 },
158 {OUString(SC_UNONAME_CELLVJUS
), ATTR_VER_JUSTIFY
, ::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
159 {OUString(SC_UNONAME_CELLVJUS_METHOD
), ATTR_VER_JUSTIFY_METHOD
, ::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
160 {OUString(SC_UNONAME_WRITING
), ATTR_WRITINGDIR
, cppu::UnoType
<sal_Int16
>::get(), 0, 0 },
161 {OUString(SC_UNONAME_HIDDEN
), ATTR_HIDDEN
, cppu::UnoType
<sal_Bool
>::get(), 0, 0 },
162 {OUString(SC_UNONAME_HYPERLINK
), ATTR_HYPERLINK
, cppu::UnoType
<OUString
>::get(), 0, 0 },
163 { OUString(), 0, css::uno::Type(), 0, 0 }
165 static SfxItemPropertySet
aCellStyleSet_Impl( aCellStyleMap_Impl
);
166 return &aCellStyleSet_Impl
;
169 // Map mit allen Seitenattributen, incl. Kopf-/Fusszeilenattribute
171 static const SfxItemPropertySet
* lcl_GetPageStyleSet()
173 static const SfxItemPropertyMapEntry aPageStyleMap_Impl
[] =
175 {OUString(SC_UNO_PAGE_BACKCOLOR
), ATTR_BACKGROUND
, ::cppu::UnoType
<sal_Int32
>::get(), 0, MID_BACK_COLOR
},
176 {OUString(SC_UNO_PAGE_GRAPHICFILT
), ATTR_BACKGROUND
, ::cppu::UnoType
<OUString
>::get(), 0, MID_GRAPHIC_FILTER
},
177 {OUString(SC_UNO_PAGE_GRAPHICLOC
), ATTR_BACKGROUND
, ::cppu::UnoType
<style::GraphicLocation
>::get(), 0, MID_GRAPHIC_POSITION
},
178 {OUString(SC_UNO_PAGE_GRAPHICURL
), ATTR_BACKGROUND
, ::cppu::UnoType
<OUString
>::get(), 0, MID_GRAPHIC_URL
},
179 {OUString(SC_UNO_PAGE_BACKTRANS
), ATTR_BACKGROUND
, cppu::UnoType
<bool>::get(), 0, MID_GRAPHIC_TRANSPARENT
},
180 {OUString(OLD_UNO_PAGE_BACKCOLOR
), ATTR_BACKGROUND
, ::cppu::UnoType
<sal_Int32
>::get(), 0, MID_BACK_COLOR
},
181 {OUString(SC_UNO_PAGE_BORDERDIST
), ATTR_BORDER
, ::cppu::UnoType
<sal_Int32
>::get(), 0, BORDER_DISTANCE
| CONVERT_TWIPS
},
182 {OUString(SC_UNO_PAGE_BOTTBORDER
), ATTR_BORDER
, ::cppu::UnoType
<table::BorderLine
>::get(), 0, BOTTOM_BORDER
| CONVERT_TWIPS
},
183 {OUString(SC_UNO_PAGE_BOTTBRDDIST
), ATTR_BORDER
, ::cppu::UnoType
<sal_Int32
>::get(), 0, BOTTOM_BORDER_DISTANCE
| CONVERT_TWIPS
},
184 {OUString(SC_UNO_PAGE_BOTTMARGIN
), ATTR_ULSPACE
, ::cppu::UnoType
<sal_Int32
>::get(), 0, MID_LO_MARGIN
| CONVERT_TWIPS
},
185 {OUString(SC_UNO_PAGE_CENTERHOR
), ATTR_PAGE_HORCENTER
,cppu::UnoType
<bool>::get(), 0, 0 },
186 {OUString(SC_UNO_PAGE_CENTERVER
), ATTR_PAGE_VERCENTER
,cppu::UnoType
<bool>::get(), 0, 0 },
187 {OUString(SC_UNONAME_DISPNAME
), SC_WID_UNO_DISPNAME
,::cppu::UnoType
<OUString
>::get(), beans::PropertyAttribute::READONLY
, 0 },
188 {OUString(SC_UNO_PAGE_FIRSTPAGE
), ATTR_PAGE_FIRSTPAGENO
,::cppu::UnoType
<sal_Int16
>::get(), 0, 0 },
190 {OUString(SC_UNO_PAGE_FTRBACKCOL
), SC_WID_UNO_FOOTERSET
,::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
191 {OUString(SC_UNO_PAGE_FTRGRFFILT
), SC_WID_UNO_FOOTERSET
,::cppu::UnoType
<OUString
>::get(), 0, 0 },
192 {OUString(SC_UNO_PAGE_FTRGRFLOC
), SC_WID_UNO_FOOTERSET
,::cppu::UnoType
<style::GraphicLocation
>::get(), 0, 0 },
193 {OUString(SC_UNO_PAGE_FTRGRFURL
), SC_WID_UNO_FOOTERSET
,::cppu::UnoType
<OUString
>::get(), 0, 0 },
194 {OUString(SC_UNO_PAGE_FTRBACKTRAN
), SC_WID_UNO_FOOTERSET
,cppu::UnoType
<bool>::get(), 0, 0 },
195 {OUString(OLD_UNO_PAGE_FTRBACKCOL
), SC_WID_UNO_FOOTERSET
,::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
196 {OUString(SC_UNO_PAGE_FTRBODYDIST
), SC_WID_UNO_FOOTERSET
,::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
197 {OUString(SC_UNO_PAGE_FTRBRDDIST
), SC_WID_UNO_FOOTERSET
,::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
198 {OUString(SC_UNO_PAGE_FTRBOTTBOR
), SC_WID_UNO_FOOTERSET
,::cppu::UnoType
<table::BorderLine
>::get(), 0, 0 },
199 {OUString(SC_UNO_PAGE_FTRBOTTBDIS
), SC_WID_UNO_FOOTERSET
,::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
200 {OUString(OLD_UNO_PAGE_FTRDYNAMIC
), SC_WID_UNO_FOOTERSET
,cppu::UnoType
<bool>::get(), 0, 0 },
201 {OUString(SC_UNO_PAGE_FTRHEIGHT
), SC_WID_UNO_FOOTERSET
,::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
202 {OUString(SC_UNO_PAGE_FTRDYNAMIC
), SC_WID_UNO_FOOTERSET
,cppu::UnoType
<bool>::get(), 0, 0 },
203 {OUString(SC_UNO_PAGE_FTRON
), SC_WID_UNO_FOOTERSET
,cppu::UnoType
<bool>::get(), 0, 0 },
204 {OUString(SC_UNO_PAGE_FTRSHARED
), SC_WID_UNO_FOOTERSET
,cppu::UnoType
<bool>::get(), 0, 0 },
205 {OUString(SC_UNO_PAGE_FTRLEFTBOR
), SC_WID_UNO_FOOTERSET
,::cppu::UnoType
<table::BorderLine
>::get(), 0, 0 },
206 {OUString(SC_UNO_PAGE_FTRLEFTBDIS
), SC_WID_UNO_FOOTERSET
,::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
207 {OUString(SC_UNO_PAGE_FTRLEFTMAR
), SC_WID_UNO_FOOTERSET
,::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
208 {OUString(OLD_UNO_PAGE_FTRON
), SC_WID_UNO_FOOTERSET
,cppu::UnoType
<bool>::get(), 0, 0 },
209 {OUString(SC_UNO_PAGE_FTRRIGHTBOR
), SC_WID_UNO_FOOTERSET
,::cppu::UnoType
<table::BorderLine
>::get(), 0, 0 },
210 {OUString(SC_UNO_PAGE_FTRRIGHTBDIS
),SC_WID_UNO_FOOTERSET
,::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
211 {OUString(SC_UNO_PAGE_FTRRIGHTMAR
), SC_WID_UNO_FOOTERSET
,::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
212 {OUString(SC_UNO_PAGE_FTRSHADOW
), SC_WID_UNO_FOOTERSET
,::cppu::UnoType
<table::ShadowFormat
>::get(), 0, 0 },
213 {OUString(OLD_UNO_PAGE_FTRSHARED
), SC_WID_UNO_FOOTERSET
,cppu::UnoType
<bool>::get(), 0, 0 },
214 {OUString(SC_UNO_PAGE_FTRTOPBOR
), SC_WID_UNO_FOOTERSET
,::cppu::UnoType
<table::BorderLine
>::get(), 0, 0 },
215 {OUString(SC_UNO_PAGE_FTRTOPBDIS
), SC_WID_UNO_FOOTERSET
,::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
217 {OUString(SC_UNO_PAGE_HDRBACKCOL
), SC_WID_UNO_HEADERSET
,::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
218 {OUString(SC_UNO_PAGE_HDRGRFFILT
), SC_WID_UNO_HEADERSET
,::cppu::UnoType
<OUString
>::get(), 0, 0 },
219 {OUString(SC_UNO_PAGE_HDRGRFLOC
), SC_WID_UNO_HEADERSET
,::cppu::UnoType
<style::GraphicLocation
>::get(), 0, 0 },
220 {OUString(SC_UNO_PAGE_HDRGRFURL
), SC_WID_UNO_HEADERSET
,::cppu::UnoType
<OUString
>::get(), 0, 0 },
221 {OUString(SC_UNO_PAGE_HDRBACKTRAN
), SC_WID_UNO_HEADERSET
,cppu::UnoType
<bool>::get(), 0, 0 },
222 {OUString(OLD_UNO_PAGE_HDRBACKCOL
), SC_WID_UNO_HEADERSET
,::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
223 {OUString(SC_UNO_PAGE_HDRBODYDIST
), SC_WID_UNO_HEADERSET
,::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
224 {OUString(SC_UNO_PAGE_HDRBRDDIST
), SC_WID_UNO_HEADERSET
,::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
225 {OUString(SC_UNO_PAGE_HDRBOTTBOR
), SC_WID_UNO_HEADERSET
,::cppu::UnoType
<table::BorderLine
>::get(), 0, 0 },
226 {OUString(SC_UNO_PAGE_HDRBOTTBDIS
), SC_WID_UNO_HEADERSET
,::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
227 {OUString(OLD_UNO_PAGE_HDRDYNAMIC
), SC_WID_UNO_HEADERSET
,cppu::UnoType
<bool>::get(), 0, 0 },
228 {OUString(SC_UNO_PAGE_HDRHEIGHT
), SC_WID_UNO_HEADERSET
,::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
229 {OUString(SC_UNO_PAGE_HDRDYNAMIC
), SC_WID_UNO_HEADERSET
,cppu::UnoType
<bool>::get(), 0, 0 },
230 {OUString(SC_UNO_PAGE_HDRON
), SC_WID_UNO_HEADERSET
,cppu::UnoType
<bool>::get(), 0, 0 },
231 {OUString(SC_UNO_PAGE_HDRSHARED
), SC_WID_UNO_HEADERSET
,cppu::UnoType
<bool>::get(), 0, 0 },
232 {OUString(SC_UNO_PAGE_HDRLEFTBOR
), SC_WID_UNO_HEADERSET
,::cppu::UnoType
<table::BorderLine
>::get(), 0, 0 },
233 {OUString(SC_UNO_PAGE_HDRLEFTBDIS
), SC_WID_UNO_HEADERSET
,::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
234 {OUString(SC_UNO_PAGE_HDRLEFTMAR
), SC_WID_UNO_HEADERSET
,::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
235 {OUString(OLD_UNO_PAGE_HDRON
), SC_WID_UNO_HEADERSET
,cppu::UnoType
<bool>::get(), 0, 0 },
236 {OUString(SC_UNO_PAGE_HDRRIGHTBOR
), SC_WID_UNO_HEADERSET
,::cppu::UnoType
<table::BorderLine
>::get(), 0, 0 },
237 {OUString(SC_UNO_PAGE_HDRRIGHTBDIS
),SC_WID_UNO_HEADERSET
,::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
238 {OUString(SC_UNO_PAGE_HDRRIGHTMAR
), SC_WID_UNO_HEADERSET
,::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
239 {OUString(SC_UNO_PAGE_HDRSHADOW
), SC_WID_UNO_HEADERSET
,::cppu::UnoType
<table::ShadowFormat
>::get(), 0, 0 },
240 {OUString(OLD_UNO_PAGE_HDRSHARED
), SC_WID_UNO_HEADERSET
,cppu::UnoType
<bool>::get(), 0, 0 },
241 {OUString(SC_UNO_PAGE_HDRTOPBOR
), SC_WID_UNO_HEADERSET
,::cppu::UnoType
<table::BorderLine
>::get(), 0, 0 },
242 {OUString(SC_UNO_PAGE_HDRTOPBDIS
), SC_WID_UNO_HEADERSET
,::cppu::UnoType
<sal_Int32
>::get(), 0, 0 },
244 {OUString(SC_UNO_PAGE_HEIGHT
), ATTR_PAGE_SIZE
, ::cppu::UnoType
<sal_Int32
>::get(), 0, MID_SIZE_HEIGHT
| CONVERT_TWIPS
},
245 {OUString(OLD_UNO_PAGE_BACKTRANS
), ATTR_BACKGROUND
, cppu::UnoType
<bool>::get(), 0, MID_GRAPHIC_TRANSPARENT
},
246 {OUString(SC_UNO_PAGE_LANDSCAPE
), ATTR_PAGE
, cppu::UnoType
<bool>::get(), 0, MID_PAGE_ORIENTATION
},
247 {OUString(SC_UNO_PAGE_LEFTBORDER
), ATTR_BORDER
, ::cppu::UnoType
<table::BorderLine
>::get(), 0, LEFT_BORDER
| CONVERT_TWIPS
},
248 {OUString(SC_UNO_PAGE_LEFTBRDDIST
), ATTR_BORDER
, ::cppu::UnoType
<sal_Int32
>::get(), 0, LEFT_BORDER_DISTANCE
| CONVERT_TWIPS
},
249 {OUString(SC_UNO_PAGE_LEFTMARGIN
), ATTR_LRSPACE
, ::cppu::UnoType
<sal_Int32
>::get(), 0, MID_L_MARGIN
| CONVERT_TWIPS
},
250 {OUString(SC_UNO_PAGE_LEFTFTRCONT
), ATTR_PAGE_FOOTERLEFT
,cppu::UnoType
<sheet::XHeaderFooterContent
>::get(), 0, 0 },
251 {OUString(SC_UNO_PAGE_LEFTHDRCONT
), ATTR_PAGE_HEADERLEFT
,cppu::UnoType
<sheet::XHeaderFooterContent
>::get(), 0, 0 },
252 {OUString(SC_UNO_PAGE_NUMBERTYPE
), ATTR_PAGE
, ::cppu::UnoType
<sal_Int16
>::get(), 0, MID_PAGE_NUMTYPE
},
253 {OUString(SC_UNO_PAGE_SCALEVAL
), ATTR_PAGE_SCALE
, ::cppu::UnoType
<sal_Int16
>::get(), 0, 0 },
254 {OUString(SC_UNO_PAGE_SYTLELAYOUT
), ATTR_PAGE
, ::cppu::UnoType
<style::PageStyleLayout
>::get(), 0, MID_PAGE_LAYOUT
},
255 {OUString(SC_UNO_PAGE_PRINTANNOT
), ATTR_PAGE_NOTES
, cppu::UnoType
<bool>::get(), 0, 0 },
256 {OUString(SC_UNO_PAGE_PRINTCHARTS
), ATTR_PAGE_CHARTS
, cppu::UnoType
<bool>::get(), 0, 0 },
257 {OUString(SC_UNO_PAGE_PRINTDOWN
), ATTR_PAGE_TOPDOWN
, cppu::UnoType
<bool>::get(), 0, 0 },
258 {OUString(SC_UNO_PAGE_PRINTDRAW
), ATTR_PAGE_DRAWINGS
, cppu::UnoType
<bool>::get(), 0, 0 },
259 {OUString(SC_UNO_PAGE_PRINTFORMUL
), ATTR_PAGE_FORMULAS
, cppu::UnoType
<bool>::get(), 0, 0 },
260 {OUString(SC_UNO_PAGE_PRINTGRID
), ATTR_PAGE_GRID
, cppu::UnoType
<bool>::get(), 0, 0 },
261 {OUString(SC_UNO_PAGE_PRINTHEADER
), ATTR_PAGE_HEADERS
, cppu::UnoType
<bool>::get(), 0, 0 },
262 {OUString(SC_UNO_PAGE_PRINTOBJS
), ATTR_PAGE_OBJECTS
, cppu::UnoType
<bool>::get(), 0, 0 },
263 {OUString(SC_UNO_PAGE_PRINTZERO
), ATTR_PAGE_NULLVALS
, cppu::UnoType
<bool>::get(), 0, 0 },
264 {OUString(SC_UNO_PAGE_PAPERTRAY
), ATTR_PAGE_PAPERBIN
, ::cppu::UnoType
<OUString
>::get(), 0, 0 },
265 {OUString(SC_UNO_PAGE_RIGHTBORDER
), ATTR_BORDER
, ::cppu::UnoType
<table::BorderLine
>::get(), 0, RIGHT_BORDER
| CONVERT_TWIPS
},
266 {OUString(SC_UNO_PAGE_RIGHTBRDDIST
),ATTR_BORDER
, ::cppu::UnoType
<sal_Int32
>::get(), 0, RIGHT_BORDER_DISTANCE
| CONVERT_TWIPS
},
267 {OUString(SC_UNO_PAGE_RIGHTMARGIN
), ATTR_LRSPACE
, ::cppu::UnoType
<sal_Int32
>::get(), 0, MID_R_MARGIN
| CONVERT_TWIPS
},
268 {OUString(SC_UNO_PAGE_RIGHTFTRCON
), ATTR_PAGE_FOOTERRIGHT
,cppu::UnoType
<sheet::XHeaderFooterContent
>::get(), 0, 0 },
269 {OUString(SC_UNO_PAGE_RIGHTHDRCON
), ATTR_PAGE_HEADERRIGHT
,cppu::UnoType
<sheet::XHeaderFooterContent
>::get(), 0, 0 },
270 {OUString(SC_UNO_PAGE_SCALETOPAG
), ATTR_PAGE_SCALETOPAGES
,::cppu::UnoType
<sal_Int16
>::get(), 0, 0 },
271 {OUString(SC_UNO_PAGE_SCALETOX
), ATTR_PAGE_SCALETO
, ::cppu::UnoType
<sal_Int16
>::get(), 0, 0 },
272 {OUString(SC_UNO_PAGE_SCALETOY
), ATTR_PAGE_SCALETO
, ::cppu::UnoType
<sal_Int16
>::get(), 0, 0 },
273 {OUString(SC_UNO_PAGE_SHADOWFORM
), ATTR_SHADOW
, ::cppu::UnoType
<table::ShadowFormat
>::get(), 0, 0 | CONVERT_TWIPS
},
274 {OUString(SC_UNO_PAGE_SIZE
), ATTR_PAGE_SIZE
, ::cppu::UnoType
<awt::Size
>::get(), 0, MID_SIZE_SIZE
| CONVERT_TWIPS
},
275 {OUString(SC_UNO_PAGE_TOPBORDER
), ATTR_BORDER
, ::cppu::UnoType
<table::BorderLine
>::get(), 0, TOP_BORDER
| CONVERT_TWIPS
},
276 {OUString(SC_UNO_PAGE_TOPBRDDIST
), ATTR_BORDER
, ::cppu::UnoType
<sal_Int32
>::get(), 0, TOP_BORDER_DISTANCE
| CONVERT_TWIPS
},
277 {OUString(SC_UNO_PAGE_TOPMARGIN
), ATTR_ULSPACE
, ::cppu::UnoType
<sal_Int32
>::get(), 0, MID_UP_MARGIN
| CONVERT_TWIPS
},
278 {OUString(OLD_UNO_PAGE_FTRBACKTRAN
),SC_WID_UNO_FOOTERSET
,cppu::UnoType
<bool>::get(), 0, 0 },
279 {OUString(OLD_UNO_PAGE_HDRBACKTRAN
),SC_WID_UNO_HEADERSET
,cppu::UnoType
<bool>::get(), 0, 0 },
280 {OUString(SC_UNONAME_USERDEF
), ATTR_USERDEF
, cppu::UnoType
<container::XNameContainer
>::get(), 0, 0 },
281 {OUString(SC_UNO_PAGE_WIDTH
), ATTR_PAGE_SIZE
, ::cppu::UnoType
<sal_Int32
>::get(), 0, MID_SIZE_WIDTH
| CONVERT_TWIPS
},
282 {OUString(SC_UNONAME_WRITING
), ATTR_WRITINGDIR
, cppu::UnoType
<sal_Int16
>::get(), 0, 0 },
283 {OUString(SC_UNONAME_HIDDEN
), ATTR_HIDDEN
, cppu::UnoType
<sal_Bool
>::get(), 0, 0 },
284 { OUString(), 0, css::uno::Type(), 0, 0 }
286 static SfxItemPropertySet
aPageStyleSet_Impl( aPageStyleMap_Impl
);
287 return &aPageStyleSet_Impl
;
290 // Map mit Inhalten des Header-Item-Sets
292 static const SfxItemPropertyMap
* lcl_GetHeaderStyleMap()
294 static const SfxItemPropertyMapEntry aHeaderStyleMap_Impl
[] =
296 {OUString(SC_UNO_PAGE_HDRBACKCOL
), ATTR_BACKGROUND
, ::cppu::UnoType
<sal_Int32
>::get(), 0, MID_BACK_COLOR
},
297 {OUString(SC_UNO_PAGE_HDRGRFFILT
), ATTR_BACKGROUND
, ::cppu::UnoType
<OUString
>::get(), 0, MID_GRAPHIC_FILTER
},
298 {OUString(SC_UNO_PAGE_HDRGRFLOC
), ATTR_BACKGROUND
, ::cppu::UnoType
<style::GraphicLocation
>::get(), 0, MID_GRAPHIC_POSITION
},
299 {OUString(SC_UNO_PAGE_HDRGRFURL
), ATTR_BACKGROUND
, ::cppu::UnoType
<OUString
>::get(), 0, MID_GRAPHIC_URL
},
300 {OUString(SC_UNO_PAGE_HDRBACKTRAN
), ATTR_BACKGROUND
, cppu::UnoType
<bool>::get(), 0, MID_GRAPHIC_TRANSPARENT
},
301 {OUString(OLD_UNO_PAGE_HDRBACKCOL
), ATTR_BACKGROUND
, ::cppu::UnoType
<sal_Int32
>::get(), 0, MID_BACK_COLOR
},
302 {OUString(SC_UNO_PAGE_HDRBODYDIST
), ATTR_ULSPACE
, ::cppu::UnoType
<sal_Int32
>::get(), 0, MID_LO_MARGIN
| CONVERT_TWIPS
},
303 {OUString(SC_UNO_PAGE_HDRBRDDIST
), ATTR_BORDER
, ::cppu::UnoType
<sal_Int32
>::get(), 0, BORDER_DISTANCE
| CONVERT_TWIPS
},
304 {OUString(SC_UNO_PAGE_HDRBOTTBOR
), ATTR_BORDER
, ::cppu::UnoType
<table::BorderLine
>::get(), 0, BOTTOM_BORDER
| CONVERT_TWIPS
},
305 {OUString(SC_UNO_PAGE_HDRBOTTBDIS
), ATTR_BORDER
, ::cppu::UnoType
<sal_Int32
>::get(), 0, BOTTOM_BORDER_DISTANCE
| CONVERT_TWIPS
},
306 {OUString(OLD_UNO_PAGE_HDRDYNAMIC
), ATTR_PAGE_DYNAMIC
, cppu::UnoType
<bool>::get(), 0, 0 },
307 {OUString(SC_UNO_PAGE_HDRHEIGHT
), ATTR_PAGE_SIZE
, ::cppu::UnoType
<sal_Int32
>::get(), 0, MID_SIZE_HEIGHT
| CONVERT_TWIPS
},
308 {OUString(SC_UNO_PAGE_HDRDYNAMIC
), ATTR_PAGE_DYNAMIC
, cppu::UnoType
<bool>::get(), 0, 0 },
309 {OUString(SC_UNO_PAGE_HDRON
), ATTR_PAGE_ON
, cppu::UnoType
<bool>::get(), 0, 0 },
310 {OUString(SC_UNO_PAGE_HDRSHARED
), ATTR_PAGE_SHARED
, cppu::UnoType
<bool>::get(), 0, 0 },
311 {OUString(SC_UNO_PAGE_HDRLEFTBOR
), ATTR_BORDER
, ::cppu::UnoType
<table::BorderLine
>::get(), 0, LEFT_BORDER
| CONVERT_TWIPS
},
312 {OUString(SC_UNO_PAGE_HDRLEFTBDIS
), ATTR_BORDER
, ::cppu::UnoType
<sal_Int32
>::get(), 0, LEFT_BORDER_DISTANCE
| CONVERT_TWIPS
},
313 {OUString(SC_UNO_PAGE_HDRLEFTMAR
), ATTR_LRSPACE
, ::cppu::UnoType
<sal_Int32
>::get(), 0, MID_L_MARGIN
| CONVERT_TWIPS
},
314 {OUString(OLD_UNO_PAGE_HDRON
), ATTR_PAGE_ON
, cppu::UnoType
<bool>::get(), 0, 0 },
315 {OUString(SC_UNO_PAGE_HDRRIGHTBOR
), ATTR_BORDER
, ::cppu::UnoType
<table::BorderLine
>::get(), 0, RIGHT_BORDER
| CONVERT_TWIPS
},
316 {OUString(SC_UNO_PAGE_HDRRIGHTBDIS
),ATTR_BORDER
, ::cppu::UnoType
<sal_Int32
>::get(), 0, RIGHT_BORDER_DISTANCE
| CONVERT_TWIPS
},
317 {OUString(SC_UNO_PAGE_HDRRIGHTMAR
), ATTR_LRSPACE
, ::cppu::UnoType
<sal_Int32
>::get(), 0, MID_R_MARGIN
| CONVERT_TWIPS
},
318 {OUString(SC_UNO_PAGE_HDRSHADOW
), ATTR_SHADOW
, ::cppu::UnoType
<table::ShadowFormat
>::get(), 0, 0 | CONVERT_TWIPS
},
319 {OUString(OLD_UNO_PAGE_HDRSHARED
), ATTR_PAGE_SHARED
, cppu::UnoType
<bool>::get(), 0, 0 },
320 {OUString(SC_UNO_PAGE_HDRTOPBOR
), ATTR_BORDER
, ::cppu::UnoType
<table::BorderLine
>::get(), 0, TOP_BORDER
| CONVERT_TWIPS
},
321 {OUString(SC_UNO_PAGE_HDRTOPBDIS
), ATTR_BORDER
, ::cppu::UnoType
<sal_Int32
>::get(), 0, TOP_BORDER_DISTANCE
| CONVERT_TWIPS
},
322 {OUString(OLD_UNO_PAGE_HDRBACKTRAN
),ATTR_BACKGROUND
, cppu::UnoType
<bool>::get(), 0, MID_GRAPHIC_TRANSPARENT
},
323 { OUString(), 0, css::uno::Type(), 0, 0 }
325 static SfxItemPropertyMap
aHeaderStyleMap( aHeaderStyleMap_Impl
);
326 return &aHeaderStyleMap
;
329 // Map mit Inhalten des Footer-Item-Sets
331 static const SfxItemPropertyMap
* lcl_GetFooterStyleMap()
333 static const SfxItemPropertyMapEntry aFooterStyleMap_Impl
[] =
335 {OUString(SC_UNO_PAGE_FTRBACKCOL
), ATTR_BACKGROUND
, ::cppu::UnoType
<sal_Int32
>::get(), 0, MID_BACK_COLOR
},
336 {OUString(SC_UNO_PAGE_FTRGRFFILT
), ATTR_BACKGROUND
, ::cppu::UnoType
<OUString
>::get(), 0, MID_GRAPHIC_FILTER
},
337 {OUString(SC_UNO_PAGE_FTRGRFLOC
), ATTR_BACKGROUND
, ::cppu::UnoType
<style::GraphicLocation
>::get(), 0, MID_GRAPHIC_POSITION
},
338 {OUString(SC_UNO_PAGE_FTRGRFURL
), ATTR_BACKGROUND
, ::cppu::UnoType
<OUString
>::get(), 0, MID_GRAPHIC_URL
},
339 {OUString(SC_UNO_PAGE_FTRBACKTRAN
), ATTR_BACKGROUND
, cppu::UnoType
<bool>::get(), 0, MID_GRAPHIC_TRANSPARENT
},
340 {OUString(OLD_UNO_PAGE_FTRBACKCOL
), ATTR_BACKGROUND
, ::cppu::UnoType
<sal_Int32
>::get(), 0, MID_BACK_COLOR
},
341 {OUString(SC_UNO_PAGE_FTRBODYDIST
), ATTR_ULSPACE
, ::cppu::UnoType
<sal_Int32
>::get(), 0, MID_UP_MARGIN
| CONVERT_TWIPS
},
342 {OUString(SC_UNO_PAGE_FTRBRDDIST
), ATTR_BORDER
, ::cppu::UnoType
<sal_Int32
>::get(), 0, BORDER_DISTANCE
| CONVERT_TWIPS
},
343 {OUString(SC_UNO_PAGE_FTRBOTTBOR
), ATTR_BORDER
, ::cppu::UnoType
<table::BorderLine
>::get(), 0, BOTTOM_BORDER
| CONVERT_TWIPS
},
344 {OUString(SC_UNO_PAGE_FTRBOTTBDIS
), ATTR_BORDER
, ::cppu::UnoType
<sal_Int32
>::get(), 0, BOTTOM_BORDER_DISTANCE
| CONVERT_TWIPS
},
345 {OUString(OLD_UNO_PAGE_FTRDYNAMIC
), ATTR_PAGE_DYNAMIC
, cppu::UnoType
<bool>::get(), 0, 0 },
346 {OUString(SC_UNO_PAGE_FTRHEIGHT
), ATTR_PAGE_SIZE
, ::cppu::UnoType
<sal_Int32
>::get(), 0, MID_SIZE_HEIGHT
| CONVERT_TWIPS
},
347 {OUString(SC_UNO_PAGE_FTRDYNAMIC
), ATTR_PAGE_DYNAMIC
, cppu::UnoType
<bool>::get(), 0, 0 },
348 {OUString(SC_UNO_PAGE_FTRON
), ATTR_PAGE_ON
, cppu::UnoType
<bool>::get(), 0, 0 },
349 {OUString(SC_UNO_PAGE_FTRSHARED
), ATTR_PAGE_SHARED
, cppu::UnoType
<bool>::get(), 0, 0 },
350 {OUString(SC_UNO_PAGE_FTRLEFTBOR
), ATTR_BORDER
, ::cppu::UnoType
<table::BorderLine
>::get(), 0, LEFT_BORDER
| CONVERT_TWIPS
},
351 {OUString(SC_UNO_PAGE_FTRLEFTBDIS
), ATTR_BORDER
, ::cppu::UnoType
<sal_Int32
>::get(), 0, LEFT_BORDER_DISTANCE
| CONVERT_TWIPS
},
352 {OUString(SC_UNO_PAGE_FTRLEFTMAR
), ATTR_LRSPACE
, ::cppu::UnoType
<sal_Int32
>::get(), 0, MID_L_MARGIN
| CONVERT_TWIPS
},
353 {OUString(OLD_UNO_PAGE_FTRON
), ATTR_PAGE_ON
, cppu::UnoType
<bool>::get(), 0, 0 },
354 {OUString(SC_UNO_PAGE_FTRRIGHTBOR
), ATTR_BORDER
, ::cppu::UnoType
<table::BorderLine
>::get(), 0, RIGHT_BORDER
| CONVERT_TWIPS
},
355 {OUString(SC_UNO_PAGE_FTRRIGHTBDIS
),ATTR_BORDER
, ::cppu::UnoType
<sal_Int32
>::get(), 0, RIGHT_BORDER_DISTANCE
| CONVERT_TWIPS
},
356 {OUString(SC_UNO_PAGE_FTRRIGHTMAR
), ATTR_LRSPACE
, ::cppu::UnoType
<sal_Int32
>::get(), 0, MID_R_MARGIN
| CONVERT_TWIPS
},
357 {OUString(SC_UNO_PAGE_FTRSHADOW
), ATTR_SHADOW
, ::cppu::UnoType
<table::ShadowFormat
>::get(), 0, 0 | CONVERT_TWIPS
},
358 {OUString(OLD_UNO_PAGE_FTRSHARED
), ATTR_PAGE_SHARED
, cppu::UnoType
<bool>::get(), 0, 0 },
359 {OUString(SC_UNO_PAGE_FTRTOPBOR
), ATTR_BORDER
, ::cppu::UnoType
<table::BorderLine
>::get(), 0, TOP_BORDER
| CONVERT_TWIPS
},
360 {OUString(SC_UNO_PAGE_FTRTOPBDIS
), ATTR_BORDER
, ::cppu::UnoType
<sal_Int32
>::get(), 0, TOP_BORDER_DISTANCE
| CONVERT_TWIPS
},
361 {OUString(OLD_UNO_PAGE_FTRBACKTRAN
),ATTR_BACKGROUND
, cppu::UnoType
<bool>::get(), 0, MID_GRAPHIC_TRANSPARENT
},
362 { OUString(), 0, css::uno::Type(), 0, 0 }
364 static SfxItemPropertyMap
aFooterStyleMap( aFooterStyleMap_Impl
);
365 return &aFooterStyleMap
;
368 // Index-Access auf die Style-Typen: 0 = Cell, 1 = Page
370 #define SC_STYLE_FAMILY_COUNT 2
372 #define SC_FAMILYNAME_CELL "CellStyles"
373 #define SC_FAMILYNAME_PAGE "PageStyles"
375 static const sal_uInt16 aStyleFamilyTypes
[SC_STYLE_FAMILY_COUNT
] = { SFX_STYLE_FAMILY_PARA
, SFX_STYLE_FAMILY_PAGE
};
377 using sc::HMMToTwips
;
378 using sc::TwipsToHMM
;
380 #define SCSTYLE_SERVICE "com.sun.star.style.Style"
381 #define SCCELLSTYLE_SERVICE "com.sun.star.style.CellStyle"
382 #define SCPAGESTYLE_SERVICE "com.sun.star.style.PageStyle"
384 SC_SIMPLE_SERVICE_INFO( ScStyleFamiliesObj
, "ScStyleFamiliesObj", "com.sun.star.style.StyleFamilies" )
385 SC_SIMPLE_SERVICE_INFO( ScStyleFamilyObj
, "ScStyleFamilyObj", "com.sun.star.style.StyleFamily" )
387 #define SC_PAPERBIN_DEFAULTNAME "[From printer settings]"
389 static bool lcl_AnyTabProtected( ScDocument
& rDoc
)
391 SCTAB nTabCount
= rDoc
.GetTableCount();
392 for (SCTAB i
=0; i
<nTabCount
; i
++)
393 if (rDoc
.IsTabProtected(i
))
398 ScStyleFamiliesObj::ScStyleFamiliesObj(ScDocShell
* pDocSh
) :
401 pDocShell
->GetDocument().AddUnoObject(*this);
404 ScStyleFamiliesObj::~ScStyleFamiliesObj()
409 pDocShell
->GetDocument().RemoveUnoObject(*this);
412 void ScStyleFamiliesObj::Notify( SfxBroadcaster
&, const SfxHint
& rHint
)
414 // Referenz-Update interessiert hier nicht
416 const SfxSimpleHint
* pSimpleHint
= dynamic_cast<const SfxSimpleHint
*>(&rHint
);
417 if ( pSimpleHint
&& pSimpleHint
->GetId() == SFX_HINT_DYING
)
419 pDocShell
= NULL
; // ungueltig geworden
425 ScStyleFamilyObj
*ScStyleFamiliesObj::GetObjectByType_Impl(sal_uInt16 nType
) const
429 if ( nType
== SFX_STYLE_FAMILY_PARA
)
430 return new ScStyleFamilyObj( pDocShell
, SFX_STYLE_FAMILY_PARA
);
431 else if ( nType
== SFX_STYLE_FAMILY_PAGE
)
432 return new ScStyleFamilyObj( pDocShell
, SFX_STYLE_FAMILY_PAGE
);
434 OSL_FAIL("getStyleFamilyByType: keine DocShell oder falscher Typ");
438 ScStyleFamilyObj
* ScStyleFamiliesObj::GetObjectByIndex_Impl(sal_uInt32 nIndex
) const
440 if ( nIndex
< SC_STYLE_FAMILY_COUNT
)
441 return GetObjectByType_Impl(aStyleFamilyTypes
[nIndex
]);
443 return NULL
; // ungueltiger Index
446 ScStyleFamilyObj
* ScStyleFamiliesObj::GetObjectByName_Impl(const OUString
& aName
) const
450 OUString
aNameStr( aName
);
451 if ( aNameStr
== SC_FAMILYNAME_CELL
)
452 return new ScStyleFamilyObj( pDocShell
, SFX_STYLE_FAMILY_PARA
);
453 else if ( aNameStr
== SC_FAMILYNAME_PAGE
)
454 return new ScStyleFamilyObj( pDocShell
, SFX_STYLE_FAMILY_PAGE
);
456 // no assertion - called directly from getByName
460 // container::XIndexAccess
462 sal_Int32 SAL_CALL
ScStyleFamiliesObj::getCount() throw(uno::RuntimeException
, std::exception
)
464 return SC_STYLE_FAMILY_COUNT
;
467 uno::Any SAL_CALL
ScStyleFamiliesObj::getByIndex( sal_Int32 nIndex
)
468 throw(lang::IndexOutOfBoundsException
,
469 lang::WrappedTargetException
, uno::RuntimeException
, std::exception
)
471 SolarMutexGuard aGuard
;
472 uno::Reference
< container::XNameContainer
> xFamily(GetObjectByIndex_Impl(nIndex
));
474 return uno::makeAny(xFamily
);
476 throw lang::IndexOutOfBoundsException();
477 // return uno::Any();
480 uno::Type SAL_CALL
ScStyleFamiliesObj::getElementType() throw(uno::RuntimeException
, std::exception
)
482 SolarMutexGuard aGuard
;
483 return cppu::UnoType
<container::XNameContainer
>::get(); // muss zu getByIndex passen
486 sal_Bool SAL_CALL
ScStyleFamiliesObj::hasElements() throw(uno::RuntimeException
, std::exception
)
488 SolarMutexGuard aGuard
;
489 return ( getCount() != 0 );
492 // container::XNameAccess
494 uno::Any SAL_CALL
ScStyleFamiliesObj::getByName( const OUString
& aName
)
495 throw(container::NoSuchElementException
,
496 lang::WrappedTargetException
, uno::RuntimeException
, std::exception
)
498 SolarMutexGuard aGuard
;
499 uno::Reference
< container::XNameContainer
> xFamily(GetObjectByName_Impl(aName
));
501 return uno::makeAny(xFamily
);
503 throw container::NoSuchElementException();
504 // return uno::Any();
507 uno::Sequence
<OUString
> SAL_CALL
ScStyleFamiliesObj::getElementNames()
508 throw(uno::RuntimeException
, std::exception
)
510 SolarMutexGuard aGuard
;
511 uno::Sequence
<OUString
> aNames(SC_STYLE_FAMILY_COUNT
);
512 OUString
* pNames
= aNames
.getArray();
513 pNames
[0] = SC_FAMILYNAME_CELL
;
514 pNames
[1] = SC_FAMILYNAME_PAGE
;
518 sal_Bool SAL_CALL
ScStyleFamiliesObj::hasByName( const OUString
& aName
)
519 throw(uno::RuntimeException
, std::exception
)
521 SolarMutexGuard aGuard
;
522 OUString
aNameStr( aName
);
523 return aNameStr
== SC_FAMILYNAME_CELL
|| aNameStr
== SC_FAMILYNAME_PAGE
;
526 // style::XStyleLoader
528 void SAL_CALL
ScStyleFamiliesObj::loadStylesFromURL( const OUString
& aURL
,
529 const uno::Sequence
<beans::PropertyValue
>& aOptions
)
530 throw(io::IOException
, uno::RuntimeException
, std::exception
)
532 //! use aOptions (like Writer)
533 //! set flag to disable filter option dialogs when importing
535 OUString aFilter
; // empty - detect
537 ScDocumentLoader
aLoader( aURL
, aFilter
, aFiltOpt
);
539 ScDocShell
* pSource
= aLoader
.GetDocShell();
541 loadStylesFromDocShell(pSource
, aOptions
);
544 uno::Sequence
<beans::PropertyValue
> SAL_CALL
ScStyleFamiliesObj::getStyleLoaderOptions()
545 throw(uno::RuntimeException
, std::exception
)
547 // return defaults for options (?)
549 uno::Sequence
<beans::PropertyValue
> aSequence(3);
550 beans::PropertyValue
* pArray
= aSequence
.getArray();
552 pArray
[0].Name
= SC_UNONAME_OVERWSTL
;
553 ScUnoHelpFunctions::SetBoolInAny( pArray
[0].Value
, true );
555 pArray
[1].Name
= SC_UNONAME_LOADCELL
;
556 ScUnoHelpFunctions::SetBoolInAny( pArray
[1].Value
, true );
558 pArray
[2].Name
= SC_UNONAME_LOADPAGE
;
559 ScUnoHelpFunctions::SetBoolInAny( pArray
[2].Value
, true );
564 // style::XStyleLoader2
566 void SAL_CALL
ScStyleFamiliesObj::loadStylesFromDocument( const uno::Reference
< lang::XComponent
> & aSourceComponent
,
567 const uno::Sequence
<beans::PropertyValue
>& aOptions
)
568 throw(io::IOException
, uno::RuntimeException
, std::exception
)
570 // Source document docShell
571 if ( !aSourceComponent
.is() )
572 throw uno::RuntimeException();
574 ScDocShell
* pDocShellSrc
= dynamic_cast<ScDocShell
*> (SfxObjectShell::GetShellFromComponent(aSourceComponent
));
576 loadStylesFromDocShell(pDocShellSrc
, aOptions
);
581 void ScStyleFamiliesObj::loadStylesFromDocShell( ScDocShell
* pSource
,
582 const uno::Sequence
<beans::PropertyValue
>& aOptions
)
583 throw(io::IOException
, uno::RuntimeException
, std::exception
)
586 if ( pSource
&& pDocShell
)
590 bool bLoadReplace
= true; // defaults
591 bool bLoadCellStyles
= true;
592 bool bLoadPageStyles
= true;
594 const beans::PropertyValue
* pPropArray
= aOptions
.getConstArray();
595 long nPropCount
= aOptions
.getLength();
596 for (long i
= 0; i
< nPropCount
; i
++)
598 const beans::PropertyValue
& rProp
= pPropArray
[i
];
599 OUString
aPropName(rProp
.Name
);
601 if (aPropName
== SC_UNONAME_OVERWSTL
)
602 bLoadReplace
= ScUnoHelpFunctions::GetBoolFromAny( rProp
.Value
);
603 else if (aPropName
== SC_UNONAME_LOADCELL
)
604 bLoadCellStyles
= ScUnoHelpFunctions::GetBoolFromAny( rProp
.Value
);
605 else if (aPropName
== SC_UNONAME_LOADPAGE
)
606 bLoadPageStyles
= ScUnoHelpFunctions::GetBoolFromAny( rProp
.Value
);
609 pDocShell
->LoadStylesArgs( *pSource
, bLoadReplace
, bLoadCellStyles
, bLoadPageStyles
);
610 pDocShell
->SetDocumentModified(); // paint is inside LoadStyles
614 ScStyleFamilyObj::ScStyleFamilyObj(ScDocShell
* pDocSh
, SfxStyleFamily eFam
) :
618 pDocShell
->GetDocument().AddUnoObject(*this);
621 ScStyleFamilyObj::~ScStyleFamilyObj()
626 pDocShell
->GetDocument().RemoveUnoObject(*this);
629 void ScStyleFamilyObj::Notify( SfxBroadcaster
&, const SfxHint
& rHint
)
631 // Referenz-Update interessiert hier nicht
633 const SfxSimpleHint
* pSimpleHint
= dynamic_cast<const SfxSimpleHint
*>(&rHint
);
634 if ( pSimpleHint
&& pSimpleHint
->GetId() == SFX_HINT_DYING
)
636 pDocShell
= NULL
; // ungueltig geworden
642 ScStyleObj
* ScStyleFamilyObj::GetObjectByIndex_Impl(sal_uInt32 nIndex
)
646 ScDocument
& rDoc
= pDocShell
->GetDocument();
647 ScStyleSheetPool
* pStylePool
= rDoc
.GetStyleSheetPool();
649 SfxStyleSheetIterator
aIter( pStylePool
, eFamily
);
650 if ( nIndex
< aIter
.Count() )
652 SfxStyleSheetBase
* pStyle
= aIter
[(sal_uInt16
)nIndex
];
655 return new ScStyleObj( pDocShell
, eFamily
, pStyle
->GetName() );
662 ScStyleObj
* ScStyleFamilyObj::GetObjectByName_Impl(const OUString
& aName
)
666 OUString
aString(aName
);
668 ScDocument
& rDoc
= pDocShell
->GetDocument();
669 ScStyleSheetPool
* pStylePool
= rDoc
.GetStyleSheetPool();
670 if ( pStylePool
->Find( aString
, eFamily
) )
671 return new ScStyleObj( pDocShell
, eFamily
, aString
);
676 void SAL_CALL
ScStyleFamilyObj::insertByName( const OUString
& aName
, const uno::Any
& aElement
)
677 throw(lang::IllegalArgumentException
, container::ElementExistException
,
678 lang::WrappedTargetException
, uno::RuntimeException
, std::exception
)
680 SolarMutexGuard aGuard
;
682 // Reflection muss nicht uno::XInterface sein, kann auch irgendein Interface sein...
683 uno::Reference
< uno::XInterface
> xInterface(aElement
, uno::UNO_QUERY
);
684 if ( xInterface
.is() )
686 ScStyleObj
* pStyleObj
= ScStyleObj::getImplementation( xInterface
);
687 if ( pStyleObj
&& pStyleObj
->GetFamily() == eFamily
&&
688 !pStyleObj
->IsInserted() ) // noch nicht eingefuegt?
690 OUString
aNameStr(ScStyleNameConversion::ProgrammaticToDisplayName( aName
, sal::static_int_cast
<sal_uInt16
>(eFamily
) ));
692 ScDocument
& rDoc
= pDocShell
->GetDocument();
693 ScStyleSheetPool
* pStylePool
= rDoc
.GetStyleSheetPool();
695 //! DocFunc-Funktion??
696 //! Undo ?????????????
698 if ( !pStylePool
->Find( aNameStr
, eFamily
) ) // noch nicht vorhanden
700 (void)pStylePool
->Make( aNameStr
, eFamily
, SFXSTYLEBIT_USERDEF
);
702 if ( eFamily
== SFX_STYLE_FAMILY_PARA
&& !rDoc
.IsImportingXML() )
703 rDoc
.GetPool()->CellStyleCreated( aNameStr
, &rDoc
);
705 pStyleObj
->InitDoc( pDocShell
, aNameStr
); // Objekt kann benutzt werden
707 if (!rDoc
.IsImportingXML())
708 pDocShell
->SetDocumentModified(); // verwendet wird der neue Style noch nicht
712 throw container::ElementExistException();
718 // other errors are handled above
719 throw lang::IllegalArgumentException();
723 void SAL_CALL
ScStyleFamilyObj::replaceByName( const OUString
& aName
, const uno::Any
& aElement
)
724 throw(lang::IllegalArgumentException
, container::NoSuchElementException
,
725 lang::WrappedTargetException
, uno::RuntimeException
, std::exception
)
727 SolarMutexGuard aGuard
;
729 removeByName( aName
);
730 insertByName( aName
, aElement
);
733 void SAL_CALL
ScStyleFamilyObj::removeByName( const OUString
& aName
)
734 throw(container::NoSuchElementException
,
735 lang::WrappedTargetException
,
736 uno::RuntimeException
,
739 SolarMutexGuard aGuard
;
743 OUString
aString(ScStyleNameConversion::ProgrammaticToDisplayName( aName
, sal::static_int_cast
<sal_uInt16
>(eFamily
) ));
745 ScDocument
& rDoc
= pDocShell
->GetDocument();
746 ScStyleSheetPool
* pStylePool
= rDoc
.GetStyleSheetPool();
748 //! DocFunc-Funktion??
749 //! Undo ?????????????
751 SfxStyleSheetBase
* pStyle
= pStylePool
->Find( aString
, eFamily
);
755 if ( eFamily
== SFX_STYLE_FAMILY_PARA
)
757 // wie ScViewFunc::RemoveStyleSheetInUse
758 ScopedVclPtrInstance
< VirtualDevice
> pVDev
;
759 Point aLogic
= pVDev
->LogicToPixel( Point(1000,1000), MAP_TWIP
);
760 double nPPTX
= aLogic
.X() / 1000.0;
761 double nPPTY
= aLogic
.Y() / 1000.0;
763 rDoc
.StyleSheetChanged( pStyle
, false, pVDev
, nPPTX
, nPPTY
, aZoom
, aZoom
);
764 pDocShell
->PostPaint( 0,0,0, MAXCOL
,MAXROW
,MAXTAB
, PAINT_GRID
|PAINT_LEFT
);
765 pDocShell
->SetDocumentModified();
767 pStylePool
->Remove( pStyle
);
769 //! InvalidateAttribs(); // Bindings-Invalidate
773 if ( rDoc
.RemovePageStyleInUse( aString
) )
774 pDocShell
->PageStyleModified( ScGlobal::GetRscString(STR_STYLENAME_STANDARD
), true );
776 pStylePool
->Remove( pStyle
);
778 SfxBindings
* pBindings
= pDocShell
->GetViewBindings();
780 pBindings
->Invalidate( SID_STYLE_FAMILY4
);
781 pDocShell
->SetDocumentModified();
787 throw container::NoSuchElementException();
790 // container::XIndexAccess
792 sal_Int32 SAL_CALL
ScStyleFamilyObj::getCount() throw(uno::RuntimeException
, std::exception
)
794 SolarMutexGuard aGuard
;
797 ScDocument
& rDoc
= pDocShell
->GetDocument();
798 ScStyleSheetPool
* pStylePool
= rDoc
.GetStyleSheetPool();
800 SfxStyleSheetIterator
aIter( pStylePool
, eFamily
);
801 return aIter
.Count();
806 uno::Any SAL_CALL
ScStyleFamilyObj::getByIndex( sal_Int32 nIndex
)
807 throw(lang::IndexOutOfBoundsException
,
808 lang::WrappedTargetException
, uno::RuntimeException
, std::exception
)
810 SolarMutexGuard aGuard
;
811 uno::Reference
< style::XStyle
> xObj(GetObjectByIndex_Impl(nIndex
));
813 return uno::makeAny(xObj
);
815 throw lang::IndexOutOfBoundsException();
816 // return uno::Any();
819 uno::Type SAL_CALL
ScStyleFamilyObj::getElementType() throw(uno::RuntimeException
, std::exception
)
821 SolarMutexGuard aGuard
;
822 return cppu::UnoType
<style::XStyle
>::get(); // muss zu getByIndex passen
825 sal_Bool SAL_CALL
ScStyleFamilyObj::hasElements() throw(uno::RuntimeException
, std::exception
)
827 SolarMutexGuard aGuard
;
828 return ( getCount() != 0 );
831 // container::XNameAccess
833 uno::Any SAL_CALL
ScStyleFamilyObj::getByName( const OUString
& aName
)
834 throw(container::NoSuchElementException
,
835 lang::WrappedTargetException
, uno::RuntimeException
, std::exception
)
837 SolarMutexGuard aGuard
;
838 uno::Reference
< style::XStyle
> xObj(
839 GetObjectByName_Impl( ScStyleNameConversion::ProgrammaticToDisplayName( aName
, sal::static_int_cast
<sal_uInt16
>(eFamily
) ) ));
841 return uno::makeAny(xObj
);
843 throw container::NoSuchElementException();
844 // return uno::Any();
847 uno::Sequence
<OUString
> SAL_CALL
ScStyleFamilyObj::getElementNames()
848 throw(uno::RuntimeException
, std::exception
)
850 SolarMutexGuard aGuard
;
853 ScDocument
& rDoc
= pDocShell
->GetDocument();
854 ScStyleSheetPool
* pStylePool
= rDoc
.GetStyleSheetPool();
856 SfxStyleSheetIterator
aIter( pStylePool
, eFamily
);
857 sal_uInt16 nCount
= aIter
.Count();
859 uno::Sequence
<OUString
> aSeq(nCount
);
860 OUString
* pAry
= aSeq
.getArray();
861 SfxStyleSheetBase
* pStyle
= aIter
.First();
865 OSL_ENSURE( nPos
<nCount
, "Anzahl durcheinandergekommen" );
867 pAry
[nPos
++] = ScStyleNameConversion::DisplayToProgrammaticName(
868 pStyle
->GetName(), sal::static_int_cast
<sal_uInt16
>(eFamily
) );
869 pStyle
= aIter
.Next();
873 return uno::Sequence
<OUString
>();
876 sal_Bool SAL_CALL
ScStyleFamilyObj::hasByName( const OUString
& aName
)
877 throw(uno::RuntimeException
, std::exception
)
879 SolarMutexGuard aGuard
;
882 OUString
aString(ScStyleNameConversion::ProgrammaticToDisplayName( aName
, sal::static_int_cast
<sal_uInt16
>(eFamily
) ));
884 ScDocument
& rDoc
= pDocShell
->GetDocument();
885 ScStyleSheetPool
* pStylePool
= rDoc
.GetStyleSheetPool();
886 if ( pStylePool
->Find( aString
, eFamily
) )
894 uno::Reference
< beans::XPropertySetInfo
> SAL_CALL
ScStyleFamilyObj::getPropertySetInfo( ) throw (uno::RuntimeException
, std::exception
)
896 OSL_FAIL( "###unexpected!" );
897 return uno::Reference
< beans::XPropertySetInfo
>();
900 void SAL_CALL
ScStyleFamilyObj::setPropertyValue( const OUString
&, const uno::Any
& ) throw (beans::UnknownPropertyException
, beans::PropertyVetoException
, lang::IllegalArgumentException
, lang::WrappedTargetException
, uno::RuntimeException
, std::exception
)
902 OSL_FAIL( "###unexpected!" );
905 uno::Any SAL_CALL
ScStyleFamilyObj::getPropertyValue( const OUString
& sPropertyName
) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
, std::exception
)
909 if ( sPropertyName
== "DisplayName" )
911 SolarMutexGuard aGuard
;
912 sal_uInt32 nResId
= 0;
915 case SFX_STYLE_FAMILY_PARA
:
916 nResId
= STR_STYLE_FAMILY_CELL
; break;
917 case SFX_STYLE_FAMILY_PAGE
:
918 nResId
= STR_STYLE_FAMILY_PAGE
; break;
920 OSL_FAIL( "ScStyleFamilyObj::getPropertyValue(): invalid family" );
924 OUString
sDisplayName( ScGlobal::GetRscString( static_cast< sal_uInt16
>( nResId
) ) );
925 aRet
= uno::makeAny( sDisplayName
);
930 throw beans::UnknownPropertyException( "unknown property: " + sPropertyName
, static_cast<OWeakObject
*>(this) );
936 void SAL_CALL
ScStyleFamilyObj::addPropertyChangeListener( const OUString
&, const uno::Reference
< beans::XPropertyChangeListener
>& ) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
, std::exception
)
938 OSL_FAIL( "###unexpected!" );
941 void SAL_CALL
ScStyleFamilyObj::removePropertyChangeListener( const OUString
&, const uno::Reference
< beans::XPropertyChangeListener
>& ) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
, std::exception
)
943 OSL_FAIL( "###unexpected!" );
946 void SAL_CALL
ScStyleFamilyObj::addVetoableChangeListener( const OUString
&, const uno::Reference
< beans::XVetoableChangeListener
>& ) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
, std::exception
)
948 OSL_FAIL( "###unexpected!" );
951 void SAL_CALL
ScStyleFamilyObj::removeVetoableChangeListener( const OUString
&, const uno::Reference
< beans::XVetoableChangeListener
>& ) throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
, std::exception
)
953 OSL_FAIL( "###unexpected!" );
956 // Default-ctor wird fuer die Reflection gebraucht
958 ScStyleObj::ScStyleObj(ScDocShell
* pDocSh
, SfxStyleFamily eFam
, const OUString
& rName
) :
959 pPropSet( (eFam
== SFX_STYLE_FAMILY_PARA
) ? lcl_GetCellStyleSet() : lcl_GetPageStyleSet() ),
964 // pDocShell ist Null, wenn per ServiceProvider erzeugt
967 pDocShell
->GetDocument().AddUnoObject(*this);
970 void ScStyleObj::InitDoc( ScDocShell
* pNewDocSh
, const OUString
& rNewName
)
972 if ( pNewDocSh
&& !pDocShell
)
974 aStyleName
= rNewName
;
975 pDocShell
= pNewDocSh
;
976 pDocShell
->GetDocument().AddUnoObject(*this);
980 ScStyleObj::~ScStyleObj()
985 pDocShell
->GetDocument().RemoveUnoObject(*this);
990 sal_Int64 SAL_CALL
ScStyleObj::getSomething(
991 const uno::Sequence
<sal_Int8
>& rId
) throw(uno::RuntimeException
, std::exception
)
993 if ( rId
.getLength() == 16 &&
994 0 == memcmp( getUnoTunnelId().getConstArray(),
995 rId
.getConstArray(), 16 ) )
997 return sal::static_int_cast
<sal_Int64
>(reinterpret_cast<sal_IntPtr
>(this));
1004 class theScStyleObjUnoTunnelId
: public rtl::Static
< UnoTunnelIdInit
, theScStyleObjUnoTunnelId
> {};
1007 const uno::Sequence
<sal_Int8
>& ScStyleObj::getUnoTunnelId()
1009 return theScStyleObjUnoTunnelId::get().getSeq();
1012 ScStyleObj
* ScStyleObj::getImplementation(const uno::Reference
<uno::XInterface
>& rObj
)
1014 ScStyleObj
* pRet
= NULL
;
1015 uno::Reference
<lang::XUnoTunnel
> xUT(rObj
, uno::UNO_QUERY
);
1017 pRet
= reinterpret_cast<ScStyleObj
*>(sal::static_int_cast
<sal_IntPtr
>(xUT
->getSomething(getUnoTunnelId())));
1021 void ScStyleObj::Notify( SfxBroadcaster
&, const SfxHint
& rHint
)
1023 // Referenz-Update interessiert hier nicht
1025 const SfxSimpleHint
* pSimpleHint
= dynamic_cast<const SfxSimpleHint
*>(&rHint
);
1026 if ( pSimpleHint
&& pSimpleHint
->GetId() == SFX_HINT_DYING
)
1028 pDocShell
= NULL
; // ungueltig geworden
1032 SfxStyleSheetBase
* ScStyleObj::GetStyle_Impl()
1036 ScDocument
& rDoc
= pDocShell
->GetDocument();
1037 ScStyleSheetPool
* pStylePool
= rDoc
.GetStyleSheetPool();
1038 return pStylePool
->Find( aStyleName
, eFamily
);
1045 sal_Bool SAL_CALL
ScStyleObj::isUserDefined() throw(uno::RuntimeException
, std::exception
)
1047 SolarMutexGuard aGuard
;
1048 SfxStyleSheetBase
* pStyle
= GetStyle_Impl();
1050 return pStyle
->IsUserDefined();
1054 sal_Bool SAL_CALL
ScStyleObj::isInUse() throw(uno::RuntimeException
, std::exception
)
1056 SolarMutexGuard aGuard
;
1057 SfxStyleSheetBase
* pStyle
= GetStyle_Impl();
1059 return pStyle
->IsUsed();
1063 OUString SAL_CALL
ScStyleObj::getParentStyle() throw(uno::RuntimeException
, std::exception
)
1065 SolarMutexGuard aGuard
;
1066 SfxStyleSheetBase
* pStyle
= GetStyle_Impl();
1068 return ScStyleNameConversion::DisplayToProgrammaticName( pStyle
->GetParent(), sal::static_int_cast
<sal_uInt16
>(eFamily
) );
1072 void SAL_CALL
ScStyleObj::setParentStyle( const OUString
& rParentStyle
)
1073 throw(container::NoSuchElementException
,
1074 uno::RuntimeException
,
1077 SolarMutexGuard aGuard
;
1078 SfxStyleSheetBase
* pStyle
= GetStyle_Impl();
1081 // cell styles cannot be modified if any sheet is protected
1082 if ( eFamily
== SFX_STYLE_FAMILY_PARA
&& lcl_AnyTabProtected( pDocShell
->GetDocument() ) )
1083 return; //! exception?
1085 //! DocFunc-Funktion??
1086 //! Undo ?????????????
1088 OUString
aString(ScStyleNameConversion::ProgrammaticToDisplayName( rParentStyle
, sal::static_int_cast
<sal_uInt16
>(eFamily
) ));
1089 bool bOk
= pStyle
->SetParent( aString
);
1092 // wie bei setPropertyValue
1094 ScDocument
& rDoc
= pDocShell
->GetDocument();
1095 if ( eFamily
== SFX_STYLE_FAMILY_PARA
)
1097 // Zeilenhoehen anpassen...
1099 ScopedVclPtrInstance
< VirtualDevice
> pVDev
;
1100 Point aLogic
= pVDev
->LogicToPixel( Point(1000,1000), MAP_TWIP
);
1101 double nPPTX
= aLogic
.X() / 1000.0;
1102 double nPPTY
= aLogic
.Y() / 1000.0;
1103 Fraction
aZoom(1,1);
1104 rDoc
.StyleSheetChanged( pStyle
, false, pVDev
, nPPTX
, nPPTY
, aZoom
, aZoom
);
1106 if (!rDoc
.IsImportingXML())
1108 pDocShell
->PostPaint( 0,0,0, MAXCOL
,MAXROW
,MAXTAB
, PAINT_GRID
|PAINT_LEFT
);
1109 pDocShell
->SetDocumentModified();
1114 //! ModifyStyleSheet am Dokument (alte Werte merken)
1116 pDocShell
->PageStyleModified( aStyleName
, true );
1122 // container::XNamed
1124 OUString SAL_CALL
ScStyleObj::getName() throw(uno::RuntimeException
, std::exception
)
1126 SolarMutexGuard aGuard
;
1127 SfxStyleSheetBase
* pStyle
= GetStyle_Impl();
1129 return ScStyleNameConversion::DisplayToProgrammaticName( pStyle
->GetName(), sal::static_int_cast
<sal_uInt16
>(eFamily
) );
1133 void SAL_CALL
ScStyleObj::setName( const OUString
& aNewName
)
1134 throw(uno::RuntimeException
, std::exception
)
1136 SolarMutexGuard aGuard
;
1137 SfxStyleSheetBase
* pStyle
= GetStyle_Impl();
1140 // cell styles cannot be renamed if any sheet is protected
1141 if ( eFamily
== SFX_STYLE_FAMILY_PARA
&& lcl_AnyTabProtected( pDocShell
->GetDocument() ) )
1142 return; //! exception?
1144 //! DocFunc-Funktion??
1145 //! Undo ?????????????
1147 OUString
aString(aNewName
);
1148 bool bOk
= pStyle
->SetName( aString
);
1151 aStyleName
= aString
; //! notify other objects for this style?
1153 ScDocument
& rDoc
= pDocShell
->GetDocument();
1154 if ( eFamily
== SFX_STYLE_FAMILY_PARA
&& !rDoc
.IsImportingXML() )
1155 rDoc
.GetPool()->CellStyleCreated( aString
, &rDoc
);
1157 // Zellvorlagen = 2, Seitenvorlagen = 4
1158 sal_uInt16 nId
= ( eFamily
== SFX_STYLE_FAMILY_PARA
) ?
1159 SID_STYLE_FAMILY2
: SID_STYLE_FAMILY4
;
1160 SfxBindings
* pBindings
= pDocShell
->GetViewBindings();
1163 pBindings
->Invalidate( nId
);
1164 pBindings
->Invalidate( SID_STYLE_APPLY
);
1170 uno::Reference
<container::XIndexReplace
> ScStyleObj::CreateEmptyNumberingRules()
1172 SvxNumRule
aRule( SvxNumRuleFlags::NONE
, 0, true ); // nothing supported
1173 return SvxCreateNumRule( &aRule
);
1176 // beans::XPropertyState
1178 const SfxItemSet
* ScStyleObj::GetStyleItemSet_Impl( const OUString
& rPropName
,
1179 const SfxItemPropertySimpleEntry
*& rpResultEntry
)
1181 //! OUString as argument?
1183 SfxStyleSheetBase
* pStyle
= GetStyle_Impl();
1186 const SfxItemPropertySimpleEntry
* pEntry
= NULL
;
1187 if ( eFamily
== SFX_STYLE_FAMILY_PAGE
)
1189 pEntry
= lcl_GetHeaderStyleMap()->getByName( rPropName
);
1190 if ( pEntry
) // only item-wids in header/footer map
1192 rpResultEntry
= pEntry
;
1193 return &static_cast<const SvxSetItem
&>(pStyle
->GetItemSet().Get(ATTR_PAGE_HEADERSET
)).GetItemSet();
1195 pEntry
= lcl_GetFooterStyleMap()->getByName( rPropName
);
1196 if ( pEntry
) // only item-wids in header/footer map
1198 rpResultEntry
= pEntry
;
1199 return &static_cast<const SvxSetItem
&>(pStyle
->GetItemSet().Get(ATTR_PAGE_FOOTERSET
)).GetItemSet();
1202 pEntry
= pPropSet
->getPropertyMap().getByName( rPropName
);
1205 rpResultEntry
= pEntry
;
1206 return &pStyle
->GetItemSet();
1210 rpResultEntry
= NULL
;
1214 beans::PropertyState SAL_CALL
ScStyleObj::getPropertyState( const OUString
& aPropertyName
)
1215 throw(beans::UnknownPropertyException
, uno::RuntimeException
, std::exception
)
1217 SolarMutexGuard aGuard
;
1218 beans::PropertyState eRet
= beans::PropertyState_DIRECT_VALUE
;
1220 const SfxItemPropertySimpleEntry
* pResultEntry
= NULL
;
1221 const SfxItemSet
* pItemSet
= GetStyleItemSet_Impl( aPropertyName
, pResultEntry
);
1223 if ( pItemSet
&& pResultEntry
)
1225 sal_uInt16 nWhich
= pResultEntry
->nWID
;
1226 if ( nWhich
== SC_WID_UNO_TBLBORD
|| nWhich
== SC_WID_UNO_TBLBORD2
)
1228 nWhich
= ATTR_BORDER
;
1230 if ( IsScItemWid( nWhich
) )
1232 SfxItemState eState
= pItemSet
->GetItemState( nWhich
, false );
1234 // // if no rotate value is set, look at orientation
1235 // //! also for a fixed value of 0 (in case orientation is ambiguous)?
1236 // if ( nWhich == ATTR_ROTATE_VALUE && eState == SfxItemState::DEFAULT )
1237 // eState = pItemSet->GetItemState( ATTR_ORIENTATION, sal_False );
1239 if ( eState
== SfxItemState::SET
)
1240 eRet
= beans::PropertyState_DIRECT_VALUE
;
1241 else if ( eState
== SfxItemState::DEFAULT
)
1242 eRet
= beans::PropertyState_DEFAULT_VALUE
;
1243 else if ( eState
== SfxItemState::DONTCARE
)
1244 eRet
= beans::PropertyState_AMBIGUOUS_VALUE
; // kann eigentlich nicht sein...
1247 OSL_FAIL("unbekannter ItemState");
1254 uno::Sequence
<beans::PropertyState
> SAL_CALL
ScStyleObj::getPropertyStates(
1255 const uno::Sequence
<OUString
>& aPropertyNames
)
1256 throw(beans::UnknownPropertyException
, uno::RuntimeException
, std::exception
)
1258 // duemmliche Default-Implementierung: alles einzeln per getPropertyState holen
1259 //! sollte optimiert werden!
1261 SolarMutexGuard aGuard
;
1262 const OUString
* pNames
= aPropertyNames
.getConstArray();
1263 uno::Sequence
<beans::PropertyState
> aRet(aPropertyNames
.getLength());
1264 beans::PropertyState
* pStates
= aRet
.getArray();
1265 for(sal_Int32 i
= 0; i
< aPropertyNames
.getLength(); i
++)
1266 pStates
[i
] = getPropertyState(pNames
[i
]);
1270 void SAL_CALL
ScStyleObj::setPropertyToDefault( const OUString
& aPropertyName
)
1271 throw(beans::UnknownPropertyException
, uno::RuntimeException
,
1274 SolarMutexGuard aGuard
;
1276 const SfxItemPropertyMap
& rMap
= pPropSet
->getPropertyMap();
1277 const SfxItemPropertySimpleEntry
* pEntry
= rMap
.getByName( aPropertyName
);
1279 throw beans::UnknownPropertyException();
1281 SetOnePropertyValue( aPropertyName
, pEntry
, NULL
);
1284 uno::Any SAL_CALL
ScStyleObj::getPropertyDefault( const OUString
& aPropertyName
)
1285 throw(beans::UnknownPropertyException
, lang::WrappedTargetException
,
1286 uno::RuntimeException
, std::exception
)
1288 SolarMutexGuard aGuard
;
1291 const SfxItemPropertySimpleEntry
* pResultEntry
= NULL
;
1292 const SfxItemSet
* pStyleSet
= GetStyleItemSet_Impl( aPropertyName
, pResultEntry
);
1294 if ( pStyleSet
&& pResultEntry
)
1296 sal_uInt16 nWhich
= pResultEntry
->nWID
;
1298 if ( IsScItemWid( nWhich
) )
1300 // Default ist Default vom ItemPool, nicht vom Standard-Style,
1301 // damit es zu setPropertyToDefault passt
1302 SfxItemSet
aEmptySet( *pStyleSet
->GetPool(), pStyleSet
->GetRanges() );
1303 // Default-Items mit falscher Slot-ID funktionieren im SfxItemPropertySet3 nicht
1304 //! Slot-IDs aendern...
1305 if ( aEmptySet
.GetPool()->GetSlotId(nWhich
) == nWhich
&&
1306 aEmptySet
.GetItemState(nWhich
, false) == SfxItemState::DEFAULT
)
1308 aEmptySet
.Put( aEmptySet
.Get( nWhich
) );
1310 const SfxItemSet
* pItemSet
= &aEmptySet
;
1312 switch ( nWhich
) // fuer Item-Spezial-Behandlungen
1314 case ATTR_VALUE_FORMAT
:
1315 // default has no language set
1316 aAny
<<= sal_Int32( static_cast<const SfxUInt32Item
&>(pItemSet
->Get(nWhich
)).GetValue() );
1319 aAny
<<= sal_Int16( TwipsToHMM(static_cast<const SfxUInt16Item
&>(
1320 pItemSet
->Get(nWhich
)).GetValue()) );
1322 case ATTR_PAGE_SCALE
:
1323 case ATTR_PAGE_SCALETOPAGES
:
1324 case ATTR_PAGE_FIRSTPAGENO
:
1325 aAny
<<= sal_Int16( static_cast<const SfxUInt16Item
&>(pItemSet
->Get(nWhich
)).GetValue() );
1327 case ATTR_PAGE_CHARTS
:
1328 case ATTR_PAGE_OBJECTS
:
1329 case ATTR_PAGE_DRAWINGS
:
1330 //! sal_Bool-MID fuer ScViewObjectModeItem definieren?
1331 aAny
<<= static_cast<const ScViewObjectModeItem
&>(pItemSet
->Get(nWhich
)).GetValue() == VOBJ_MODE_SHOW
;
1333 case ATTR_PAGE_SCALETO
:
1335 const ScPageScaleToItem
aItem(static_cast<const ScPageScaleToItem
&>(pItemSet
->Get(nWhich
)));
1336 if ( aPropertyName
== SC_UNO_PAGE_SCALETOX
)
1337 aAny
= uno::makeAny(static_cast<sal_Int16
>(aItem
.GetWidth()));
1339 aAny
= uno::makeAny(static_cast<sal_Int16
>(aItem
.GetHeight()));
1343 pPropSet
->getPropertyValue( *pResultEntry
, *pItemSet
, aAny
);
1346 else if ( IsScUnoWid( nWhich
) )
1348 SfxItemSet
aEmptySet( *pStyleSet
->GetPool(), pStyleSet
->GetRanges() );
1349 const SfxItemSet
* pItemSet
= &aEmptySet
;
1352 case SC_WID_UNO_TBLBORD
:
1353 case SC_WID_UNO_TBLBORD2
:
1355 const SfxPoolItem
* pItem
= &pItemSet
->Get( ATTR_BORDER
);
1358 SvxBoxItem
aOuter( *( static_cast<const SvxBoxItem
*>( pItem
) ) );
1359 SvxBoxInfoItem
aInner( ATTR_BORDER_INNER
);
1360 if (nWhich
== SC_WID_UNO_TBLBORD2
)
1361 ScHelperFunctions::AssignTableBorder2ToAny( aAny
, aOuter
, aInner
, true);
1363 ScHelperFunctions::AssignTableBorderToAny( aAny
, aOuter
, aInner
, true);
1373 // XMultiPropertySet
1375 void SAL_CALL
ScStyleObj::setPropertyValues( const uno::Sequence
< OUString
>& aPropertyNames
,
1376 const uno::Sequence
< uno::Any
>& aValues
)
1377 throw (beans::PropertyVetoException
, lang::IllegalArgumentException
,
1378 lang::WrappedTargetException
, uno::RuntimeException
,
1381 SolarMutexGuard aGuard
;
1383 sal_Int32 nCount
= aPropertyNames
.getLength();
1384 if ( aValues
.getLength() != nCount
)
1385 throw lang::IllegalArgumentException();
1389 const OUString
* pNames
= aPropertyNames
.getConstArray();
1390 const uno::Any
* pValues
= aValues
.getConstArray();
1392 const SfxItemPropertyMap
& rPropertyMap
= pPropSet
->getPropertyMap();
1393 for (sal_Int32 i
= 0; i
< nCount
; i
++)
1395 const SfxItemPropertySimpleEntry
* pEntry
= rPropertyMap
.getByName( pNames
[i
] );
1396 SetOnePropertyValue( pNames
[i
], pEntry
, &pValues
[i
] );
1401 uno::Sequence
<uno::Any
> SAL_CALL
ScStyleObj::getPropertyValues(
1402 const uno::Sequence
< OUString
>& aPropertyNames
)
1403 throw (uno::RuntimeException
, std::exception
)
1405 SolarMutexGuard aGuard
;
1409 sal_Int32 nCount
= aPropertyNames
.getLength();
1410 uno::Sequence
<uno::Any
> aSequence( nCount
);
1413 uno::Any
* pValues
= aSequence
.getArray();
1414 for (sal_Int32 i
=0; i
<nCount
; i
++)
1415 pValues
[i
] = getPropertyValue( aPropertyNames
[i
] );
1420 void SAL_CALL
ScStyleObj::addPropertiesChangeListener( const uno::Sequence
<OUString
>& /* aPropertyNames */,
1421 const uno::Reference
<beans::XPropertiesChangeListener
>& /* xListener */ )
1422 throw (uno::RuntimeException
, std::exception
)
1424 // no bound properties
1427 void SAL_CALL
ScStyleObj::removePropertiesChangeListener(
1428 const uno::Reference
<beans::XPropertiesChangeListener
>& /* xListener */ )
1429 throw (uno::RuntimeException
, std::exception
)
1431 // no bound properties
1434 void SAL_CALL
ScStyleObj::firePropertiesChangeEvent( const uno::Sequence
<OUString
>& /* aPropertyNames */,
1435 const uno::Reference
<beans::XPropertiesChangeListener
>& /* xListener */ )
1436 throw (uno::RuntimeException
, std::exception
)
1438 // no bound properties
1441 // XMultiPropertyStates
1442 // getPropertyStates already defined for XPropertyState
1444 void SAL_CALL
ScStyleObj::setAllPropertiesToDefault()
1445 throw (uno::RuntimeException
, std::exception
)
1447 SolarMutexGuard aGuard
;
1449 SfxStyleSheetBase
* pStyle
= GetStyle_Impl();
1452 // cell styles cannot be modified if any sheet is protected
1453 if ( eFamily
== SFX_STYLE_FAMILY_PARA
&& lcl_AnyTabProtected( pDocShell
->GetDocument() ) )
1454 throw uno::RuntimeException();
1456 SfxItemSet
& rSet
= pStyle
->GetItemSet();
1457 rSet
.ClearItem(); // set all items to default
1459 //! merge with SetOneProperty
1461 ScDocument
& rDoc
= pDocShell
->GetDocument();
1462 if ( eFamily
== SFX_STYLE_FAMILY_PARA
)
1466 ScopedVclPtrInstance
< VirtualDevice
> pVDev
;
1467 Point aLogic
= pVDev
->LogicToPixel( Point(1000,1000), MAP_TWIP
);
1468 double nPPTX
= aLogic
.X() / 1000.0;
1469 double nPPTY
= aLogic
.Y() / 1000.0;
1470 Fraction
aZoom(1,1);
1471 rDoc
.StyleSheetChanged( pStyle
, false, pVDev
, nPPTX
, nPPTY
, aZoom
, aZoom
);
1473 if (!rDoc
.IsImportingXML())
1475 pDocShell
->PostPaint( 0,0,0, MAXCOL
,MAXROW
,MAXTAB
, PAINT_GRID
|PAINT_LEFT
);
1476 pDocShell
->SetDocumentModified();
1481 // #i22448# apply the default BoxInfoItem for page styles again
1482 // (same content as in ScStyleSheet::GetItemSet, to control the dialog)
1483 SvxBoxInfoItem
aBoxInfoItem( ATTR_BORDER_INNER
);
1484 aBoxInfoItem
.SetTable( false );
1485 aBoxInfoItem
.SetDist( true );
1486 aBoxInfoItem
.SetValid( SvxBoxInfoItemValidFlags::DISTANCE
, true );
1487 rSet
.Put( aBoxInfoItem
);
1489 pDocShell
->PageStyleModified( aStyleName
, true );
1494 void SAL_CALL
ScStyleObj::setPropertiesToDefault( const uno::Sequence
<OUString
>& aPropertyNames
)
1495 throw (beans::UnknownPropertyException
, uno::RuntimeException
,
1498 SolarMutexGuard aGuard
;
1500 sal_Int32 nCount
= aPropertyNames
.getLength();
1503 const OUString
* pNames
= aPropertyNames
.getConstArray();
1505 const SfxItemPropertyMap
& rPropertyMap
= pPropSet
->getPropertyMap();
1506 for (sal_Int32 i
= 0; i
< nCount
; i
++)
1508 const SfxItemPropertySimpleEntry
* pEntry
= rPropertyMap
.getByName( pNames
[i
] );
1509 SetOnePropertyValue( pNames
[i
], pEntry
, NULL
);
1514 uno::Sequence
<uno::Any
> SAL_CALL
ScStyleObj::getPropertyDefaults(
1515 const uno::Sequence
<OUString
>& aPropertyNames
)
1516 throw (beans::UnknownPropertyException
, lang::WrappedTargetException
,
1517 uno::RuntimeException
, std::exception
)
1519 SolarMutexGuard aGuard
;
1523 sal_Int32 nCount
= aPropertyNames
.getLength();
1524 uno::Sequence
<uno::Any
> aSequence( nCount
);
1527 uno::Any
* pValues
= aSequence
.getArray();
1528 for (sal_Int32 i
=0; i
<nCount
; i
++)
1529 pValues
[i
] = getPropertyDefault( aPropertyNames
[i
] );
1534 // beans::XPropertySet
1536 uno::Reference
<beans::XPropertySetInfo
> SAL_CALL
ScStyleObj::getPropertySetInfo()
1537 throw(uno::RuntimeException
, std::exception
)
1539 SolarMutexGuard aGuard
;
1540 return pPropSet
->getPropertySetInfo();
1543 void SAL_CALL
ScStyleObj::setPropertyValue(
1544 const OUString
& aPropertyName
, const uno::Any
& aValue
)
1545 throw(beans::UnknownPropertyException
, beans::PropertyVetoException
,
1546 lang::IllegalArgumentException
, lang::WrappedTargetException
,
1547 uno::RuntimeException
, std::exception
)
1549 SolarMutexGuard aGuard
;
1551 const SfxItemPropertySimpleEntry
* pEntry
= pPropSet
->getPropertyMap().getByName( aPropertyName
);
1553 throw beans::UnknownPropertyException();
1555 SetOnePropertyValue( aPropertyName
, pEntry
, &aValue
);
1558 void ScStyleObj::SetOnePropertyValue( const OUString
& rPropertyName
, const SfxItemPropertySimpleEntry
* pEntry
, const uno::Any
* pValue
)
1559 throw(lang::IllegalArgumentException
,
1560 uno::RuntimeException
,
1563 SfxStyleSheetBase
* pStyle
= GetStyle_Impl();
1564 if ( pStyle
&& pEntry
)
1566 // cell styles cannot be modified if any sheet is protected
1567 if ( eFamily
== SFX_STYLE_FAMILY_PARA
&& lcl_AnyTabProtected( pDocShell
->GetDocument() ) )
1568 throw uno::RuntimeException();
1570 SfxItemSet
& rSet
= pStyle
->GetItemSet(); // direkt im lebenden Style aendern...
1572 if ( eFamily
== SFX_STYLE_FAMILY_PAGE
)
1574 if(pEntry
->nWID
== SC_WID_UNO_HEADERSET
)
1576 const SfxItemPropertySimpleEntry
* pHeaderEntry
= lcl_GetHeaderStyleMap()->getByName( rPropertyName
);
1577 if ( pHeaderEntry
) // only item-wids in header/footer map
1579 SvxSetItem
aNewHeader( static_cast<const SvxSetItem
&>(rSet
.Get(ATTR_PAGE_HEADERSET
)) );
1581 pPropSet
->setPropertyValue( *pHeaderEntry
, *pValue
, aNewHeader
.GetItemSet() );
1583 aNewHeader
.GetItemSet().ClearItem( pHeaderEntry
->nWID
);
1584 rSet
.Put( aNewHeader
);
1588 else if(pEntry
->nWID
== SC_WID_UNO_FOOTERSET
)
1590 const SfxItemPropertySimpleEntry
* pFooterEntry
= lcl_GetFooterStyleMap()->getByName( rPropertyName
);
1591 if ( pFooterEntry
) // only item-wids in header/footer map
1593 SvxSetItem
aNewFooter( static_cast<const SvxSetItem
&>(rSet
.Get(ATTR_PAGE_FOOTERSET
)) );
1595 pPropSet
->setPropertyValue( *pFooterEntry
, *pValue
, aNewFooter
.GetItemSet() );
1597 aNewFooter
.GetItemSet().ClearItem( pFooterEntry
->nWID
);
1598 rSet
.Put( aNewFooter
);
1607 if ( IsScItemWid( pEntry
->nWID
) )
1611 switch ( pEntry
->nWID
) // fuer Item-Spezial-Behandlungen
1613 case ATTR_VALUE_FORMAT
:
1615 // language for number formats
1616 SvNumberFormatter
* pFormatter
=
1617 pDocShell
->GetDocument().GetFormatTable();
1618 sal_uInt32 nOldFormat
= static_cast<const SfxUInt32Item
&>(
1619 rSet
.Get( ATTR_VALUE_FORMAT
)).GetValue();
1620 LanguageType eOldLang
= static_cast<const SvxLanguageItem
&>(
1621 rSet
.Get( ATTR_LANGUAGE_FORMAT
)).GetLanguage();
1622 nOldFormat
= pFormatter
->
1623 GetFormatForLanguageIfBuiltIn( nOldFormat
, eOldLang
);
1625 sal_uInt32 nNewFormat
= 0;
1626 *pValue
>>= nNewFormat
;
1627 rSet
.Put( SfxUInt32Item( ATTR_VALUE_FORMAT
, nNewFormat
) );
1629 const SvNumberformat
* pNewEntry
= pFormatter
->GetEntry( nNewFormat
);
1630 LanguageType eNewLang
=
1631 pNewEntry
? pNewEntry
->GetLanguage() : LANGUAGE_DONTKNOW
;
1632 if ( eNewLang
!= eOldLang
&& eNewLang
!= LANGUAGE_DONTKNOW
)
1633 rSet
.Put( SvxLanguageItem( eNewLang
, ATTR_LANGUAGE_FORMAT
) );
1635 //! keep default state of number format if only language changed?
1642 rSet
.Put( SfxUInt16Item( pEntry
->nWID
, (sal_uInt16
)HMMToTwips(nVal
) ) );
1645 case ATTR_ROTATE_VALUE
:
1647 sal_Int32 nRotVal
= 0;
1648 if ( *pValue
>>= nRotVal
)
1650 // stored value is always between 0 and 360 deg.
1654 rSet
.Put( SfxInt32Item( ATTR_ROTATE_VALUE
, nRotVal
) );
1660 table::CellOrientation eOrient
;
1661 if( *pValue
>>= eOrient
)
1665 case table::CellOrientation_STANDARD
:
1666 rSet
.Put( SfxBoolItem( ATTR_STACKED
, false ) );
1668 case table::CellOrientation_TOPBOTTOM
:
1669 rSet
.Put( SfxBoolItem( ATTR_STACKED
, false ) );
1670 rSet
.Put( SfxInt32Item( ATTR_ROTATE_VALUE
, 27000 ) );
1672 case table::CellOrientation_BOTTOMTOP
:
1673 rSet
.Put( SfxBoolItem( ATTR_STACKED
, false ) );
1674 rSet
.Put( SfxInt32Item( ATTR_ROTATE_VALUE
, 9000 ) );
1676 case table::CellOrientation_STACKED
:
1677 rSet
.Put( SfxBoolItem( ATTR_STACKED
, true ) );
1681 // added to avoid warnings
1687 case ATTR_PAGE_SCALE
:
1688 case ATTR_PAGE_SCALETOPAGES
:
1690 rSet
.ClearItem(ATTR_PAGE_SCALETOPAGES
);
1691 rSet
.ClearItem(ATTR_PAGE_SCALE
);
1692 rSet
.ClearItem(ATTR_PAGE_SCALETO
);
1695 rSet
.Put( SfxUInt16Item( pEntry
->nWID
, nVal
) );
1698 case ATTR_PAGE_FIRSTPAGENO
:
1702 rSet
.Put( SfxUInt16Item( ATTR_PAGE_FIRSTPAGENO
, nVal
) );
1705 case ATTR_PAGE_CHARTS
:
1706 case ATTR_PAGE_OBJECTS
:
1707 case ATTR_PAGE_DRAWINGS
:
1711 //! sal_Bool-MID fuer ScViewObjectModeItem definieren?
1712 rSet
.Put( ScViewObjectModeItem( pEntry
->nWID
,
1713 bBool
? VOBJ_MODE_SHOW
: VOBJ_MODE_HIDE
) );
1716 case ATTR_PAGE_PAPERBIN
:
1718 sal_uInt8 nTray
= PAPERBIN_PRINTER_SETTINGS
;
1719 bool bFound
= false;
1722 if ( *pValue
>>= aName
)
1724 if ( aName
== SC_PAPERBIN_DEFAULTNAME
)
1728 Printer
* pPrinter
= pDocShell
->GetPrinter();
1731 sal_uInt16 nCount
= pPrinter
->GetPaperBinCount();
1732 for (sal_uInt16 i
=0; i
<nCount
; i
++)
1733 if ( aName
== pPrinter
->GetPaperBinName(i
) )
1735 nTray
= (sal_uInt8
) i
;
1743 rSet
.Put( SvxPaperBinItem( ATTR_PAGE_PAPERBIN
, nTray
) );
1745 throw lang::IllegalArgumentException();
1748 case ATTR_PAGE_SCALETO
:
1750 sal_Int16 nPages
= 0;
1751 if (*pValue
>>= nPages
)
1753 ScPageScaleToItem aItem
= static_cast<const ScPageScaleToItem
&>(rSet
.Get(ATTR_PAGE_SCALETO
));
1754 if ( rPropertyName
== SC_UNO_PAGE_SCALETOX
)
1755 aItem
.SetWidth(static_cast<sal_uInt16
>(nPages
));
1757 aItem
.SetHeight(static_cast<sal_uInt16
>(nPages
));
1759 rSet
.ClearItem(ATTR_PAGE_SCALETOPAGES
);
1760 rSet
.ClearItem(ATTR_PAGE_SCALE
);
1766 bool bHidden
= false;
1767 if ( *pValue
>>= bHidden
)
1768 pStyle
->SetHidden( bHidden
);
1772 // Default-Items mit falscher Slot-ID
1773 // funktionieren im SfxItemPropertySet3 nicht
1774 //! Slot-IDs aendern...
1775 if ( rSet
.GetPool()->GetSlotId(pEntry
->nWID
) == pEntry
->nWID
&&
1776 rSet
.GetItemState(pEntry
->nWID
, false) == SfxItemState::DEFAULT
)
1778 rSet
.Put( rSet
.Get(pEntry
->nWID
) );
1780 pPropSet
->setPropertyValue( *pEntry
, *pValue
, rSet
);
1785 rSet
.ClearItem( pEntry
->nWID
);
1786 // language for number formats
1787 if ( pEntry
->nWID
== ATTR_VALUE_FORMAT
)
1788 rSet
.ClearItem( ATTR_LANGUAGE_FORMAT
);
1790 //! for ATTR_ROTATE_VALUE, also reset ATTR_ORIENTATION?
1793 else if ( IsScUnoWid( pEntry
->nWID
) )
1795 switch ( pEntry
->nWID
)
1797 case SC_WID_UNO_TBLBORD
:
1801 table::TableBorder aBorder
;
1802 if ( *pValue
>>= aBorder
)
1804 SvxBoxItem
aOuter( ATTR_BORDER
);
1805 SvxBoxInfoItem
aInner( ATTR_BORDER_INNER
);
1806 ScHelperFunctions::FillBoxItems( aOuter
, aInner
, aBorder
);
1812 rSet
.ClearItem( ATTR_BORDER
);
1816 case SC_WID_UNO_TBLBORD2
:
1820 table::TableBorder2 aBorder2
;
1821 if ( *pValue
>>= aBorder2
)
1823 SvxBoxItem
aOuter( ATTR_BORDER
);
1824 SvxBoxInfoItem
aInner( ATTR_BORDER_INNER
);
1825 ScHelperFunctions::FillBoxItems( aOuter
, aInner
, aBorder2
);
1831 rSet
.ClearItem( ATTR_BORDER
);
1840 //! DocFunc-Funktion??
1841 //! Undo ?????????????
1843 ScDocument
& rDoc
= pDocShell
->GetDocument();
1844 if ( eFamily
== SFX_STYLE_FAMILY_PARA
)
1846 // Zeilenhoehen anpassen...
1848 ScopedVclPtrInstance
< VirtualDevice
> pVDev
;
1849 Point aLogic
= pVDev
->LogicToPixel( Point(1000,1000), MAP_TWIP
);
1850 double nPPTX
= aLogic
.X() / 1000.0;
1851 double nPPTY
= aLogic
.Y() / 1000.0;
1852 Fraction
aZoom(1,1);
1853 rDoc
.StyleSheetChanged( pStyle
, false, pVDev
, nPPTX
, nPPTY
, aZoom
, aZoom
);
1855 if (!rDoc
.IsImportingXML())
1857 pDocShell
->PostPaint( 0,0,0, MAXCOL
,MAXROW
,MAXTAB
, PAINT_GRID
|PAINT_LEFT
);
1858 pDocShell
->SetDocumentModified();
1863 //! ModifyStyleSheet am Dokument (alte Werte merken)
1865 pDocShell
->PageStyleModified( aStyleName
, true );
1870 uno::Any SAL_CALL
ScStyleObj::getPropertyValue( const OUString
& aPropertyName
)
1871 throw(beans::UnknownPropertyException
, lang::WrappedTargetException
,
1872 uno::RuntimeException
, std::exception
)
1874 SolarMutexGuard aGuard
;
1877 if ( aPropertyName
== SC_UNONAME_DISPNAME
) // read-only
1879 // core always has the display name
1880 SfxStyleSheetBase
* pStyle
= GetStyle_Impl();
1882 aAny
<<= OUString( pStyle
->GetName() );
1886 const SfxItemPropertySimpleEntry
* pResultEntry
= NULL
;
1887 const SfxItemSet
* pItemSet
= GetStyleItemSet_Impl( aPropertyName
, pResultEntry
);
1889 if ( pItemSet
&& pResultEntry
)
1891 sal_uInt16 nWhich
= pResultEntry
->nWID
;
1893 if ( IsScItemWid( nWhich
) )
1895 switch ( nWhich
) // fuer Item-Spezial-Behandlungen
1897 case ATTR_VALUE_FORMAT
:
1900 sal_uInt32 nOldFormat
= static_cast<const SfxUInt32Item
&>(
1901 pItemSet
->Get( ATTR_VALUE_FORMAT
)).GetValue();
1902 LanguageType eOldLang
= static_cast<const SvxLanguageItem
&>(
1903 pItemSet
->Get( ATTR_LANGUAGE_FORMAT
)).GetLanguage();
1904 nOldFormat
= pDocShell
->GetDocument().GetFormatTable()->
1905 GetFormatForLanguageIfBuiltIn( nOldFormat
, eOldLang
);
1906 aAny
<<= nOldFormat
;
1910 aAny
<<= sal_Int16( TwipsToHMM(static_cast<const SfxUInt16Item
&>(
1911 pItemSet
->Get(nWhich
)).GetValue()) );
1915 sal_Int32 nRot
= static_cast<const SfxInt32Item
&>(pItemSet
->Get(ATTR_ROTATE_VALUE
)).GetValue();
1916 bool bStacked
= static_cast<const SfxBoolItem
&>(pItemSet
->Get(nWhich
)).GetValue();
1917 SvxOrientationItem( nRot
, bStacked
, 0 ).QueryValue( aAny
);
1920 case ATTR_PAGE_SCALE
:
1921 case ATTR_PAGE_SCALETOPAGES
:
1922 case ATTR_PAGE_FIRSTPAGENO
:
1923 aAny
<<= sal_Int16( static_cast<const SfxUInt16Item
&>(pItemSet
->Get(nWhich
)).GetValue() );
1925 case ATTR_PAGE_CHARTS
:
1926 case ATTR_PAGE_OBJECTS
:
1927 case ATTR_PAGE_DRAWINGS
:
1928 //! sal_Bool-MID fuer ScViewObjectModeItem definieren?
1929 aAny
<<= static_cast<const ScViewObjectModeItem
&>(pItemSet
->Get(nWhich
)).GetValue() == VOBJ_MODE_SHOW
;
1931 case ATTR_PAGE_PAPERBIN
:
1933 // property PrinterPaperTray is the name of the tray
1935 sal_uInt8 nValue
= static_cast<const SvxPaperBinItem
&>(pItemSet
->Get(nWhich
)).GetValue();
1937 if ( nValue
== PAPERBIN_PRINTER_SETTINGS
)
1938 aName
= SC_PAPERBIN_DEFAULTNAME
;
1941 Printer
* pPrinter
= pDocShell
->GetPrinter();
1943 aName
= pPrinter
->GetPaperBinName( nValue
);
1948 case ATTR_PAGE_SCALETO
:
1950 ScPageScaleToItem
aItem(static_cast<const ScPageScaleToItem
&>(pItemSet
->Get(ATTR_PAGE_SCALETO
)));
1951 if ( aPropertyName
== SC_UNO_PAGE_SCALETOX
)
1952 aAny
= uno::makeAny(static_cast<sal_Int16
>(aItem
.GetWidth()));
1954 aAny
= uno::makeAny(static_cast<sal_Int16
>(aItem
.GetHeight()));
1959 bool bHidden
= false;
1960 SfxStyleSheetBase
* pStyle
= GetStyle_Impl();
1962 bHidden
= pStyle
->IsHidden();
1963 aAny
= uno::makeAny( bHidden
);
1967 // Default-Items mit falscher Slot-ID
1968 // funktionieren im SfxItemPropertySet3 nicht
1969 //! Slot-IDs aendern...
1970 if ( pItemSet
->GetPool()->GetSlotId(nWhich
) == nWhich
&&
1971 pItemSet
->GetItemState(nWhich
, false) == SfxItemState::DEFAULT
)
1973 SfxItemSet
aNoEmptySet( *pItemSet
);
1974 aNoEmptySet
.Put( aNoEmptySet
.Get( nWhich
) );
1975 pPropSet
->getPropertyValue( *pResultEntry
, aNoEmptySet
, aAny
);
1978 pPropSet
->getPropertyValue( *pResultEntry
, *pItemSet
, aAny
);
1981 else if ( IsScUnoWid( nWhich
) )
1985 case SC_WID_UNO_TBLBORD
:
1986 case SC_WID_UNO_TBLBORD2
:
1988 const SfxPoolItem
* pItem
= &pItemSet
->Get( ATTR_BORDER
);
1991 SvxBoxItem
aOuter( *( static_cast<const SvxBoxItem
*>( pItem
) ) );
1992 SvxBoxInfoItem
aInner( ATTR_BORDER_INNER
);
1993 if (nWhich
== SC_WID_UNO_TBLBORD2
)
1994 ScHelperFunctions::AssignTableBorder2ToAny( aAny
, aOuter
, aInner
, true);
1996 ScHelperFunctions::AssignTableBorderToAny( aAny
, aOuter
, aInner
, true);
2008 SC_IMPL_DUMMY_PROPERTY_LISTENER( ScStyleObj
)
2010 // lang::XServiceInfo
2012 OUString SAL_CALL
ScStyleObj::getImplementationName() throw(uno::RuntimeException
, std::exception
)
2014 return OUString("ScStyleObj" );
2017 sal_Bool SAL_CALL
ScStyleObj::supportsService( const OUString
& rServiceName
)
2018 throw(uno::RuntimeException
, std::exception
)
2020 return cppu::supportsService(this, rServiceName
);
2023 uno::Sequence
<OUString
> SAL_CALL
ScStyleObj::getSupportedServiceNames()
2024 throw(uno::RuntimeException
, std::exception
)
2026 bool bPage
= ( eFamily
== SFX_STYLE_FAMILY_PAGE
);
2027 uno::Sequence
<OUString
> aRet(2);
2028 OUString
* pArray
= aRet
.getArray();
2029 pArray
[0] = SCSTYLE_SERVICE
;
2030 pArray
[1] = bPage
? OUString(SCPAGESTYLE_SERVICE
)
2031 : OUString(SCCELLSTYLE_SERVICE
);
2035 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */