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