LCOV - code coverage report
Current view: top level - sc/source/ui/unoobj - styleuno.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 833 1077 77.3 %
Date: 2014-11-03 Functions: 69 98 70.4 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10