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