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