File: | home/maarten/src/libreoffice/core/include/rtl/ref.hxx |
Warning: | line 192, column 9 Use of memory after it is freed |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
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.h> | |||
22 | #include <svx/algitem.hxx> | |||
23 | #include <editeng/boxitem.hxx> | |||
24 | #include <editeng/justifyitem.hxx> | |||
25 | #include <editeng/langitem.hxx> | |||
26 | #include <editeng/numitem.hxx> | |||
27 | #include <editeng/shaditem.hxx> | |||
28 | #include <svx/pageitem.hxx> | |||
29 | #include <editeng/pbinitem.hxx> | |||
30 | #include <svx/unomid.hxx> | |||
31 | #include <editeng/unonrule.hxx> | |||
32 | #include <sfx2/bindings.hxx> | |||
33 | #include <sfx2/printer.hxx> | |||
34 | #include <sfx2/sfxsids.hrc> | |||
35 | #include <vcl/virdev.hxx> | |||
36 | #include <vcl/svapp.hxx> | |||
37 | #include <svl/itempool.hxx> | |||
38 | #include <svl/itemset.hxx> | |||
39 | #include <svl/intitem.hxx> | |||
40 | #include <svl/zformat.hxx> | |||
41 | #include <tools/fract.hxx> | |||
42 | #include <osl/diagnose.h> | |||
43 | ||||
44 | #include <com/sun/star/table/BorderLine.hpp> | |||
45 | #include <com/sun/star/table/TableBorder.hpp> | |||
46 | #include <com/sun/star/table/TableBorder2.hpp> | |||
47 | #include <com/sun/star/table/ShadowFormat.hpp> | |||
48 | #include <com/sun/star/table/CellHoriJustify.hpp> | |||
49 | #include <com/sun/star/table/CellOrientation.hpp> | |||
50 | #include <com/sun/star/style/PageStyleLayout.hpp> | |||
51 | #include <com/sun/star/style/GraphicLocation.hpp> | |||
52 | #include <com/sun/star/sheet/XHeaderFooterContent.hpp> | |||
53 | #include <com/sun/star/util/CellProtection.hpp> | |||
54 | #include <com/sun/star/awt/FontSlant.hpp> | |||
55 | #include <com/sun/star/awt/Size.hpp> | |||
56 | #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> | |||
57 | #include <com/sun/star/lang/Locale.hpp> | |||
58 | #include <com/sun/star/beans/PropertyAttribute.hpp> | |||
59 | #include <com/sun/star/graphic/XGraphic.hpp> | |||
60 | #include <comphelper/propertysequence.hxx> | |||
61 | #include <cppuhelper/supportsservice.hxx> | |||
62 | ||||
63 | #include <styleuno.hxx> | |||
64 | #include <docsh.hxx> | |||
65 | #include <attrib.hxx> | |||
66 | #include <stlpool.hxx> | |||
67 | #include <docpool.hxx> | |||
68 | #include <miscuno.hxx> | |||
69 | #include <tablink.hxx> | |||
70 | #include <unonames.hxx> | |||
71 | #include <unowids.hxx> | |||
72 | #include <globstr.hrc> | |||
73 | #include <scresid.hxx> | |||
74 | #include <cellsuno.hxx> | |||
75 | #include <stylehelper.hxx> | |||
76 | ||||
77 | using namespace ::com::sun::star; | |||
78 | ||||
79 | static const SfxItemPropertySet* lcl_GetCellStyleSet() | |||
80 | { | |||
81 | static const SfxItemPropertyMapEntry aCellStyleMap_Impl[] = | |||
82 | { | |||
83 | {u"" SC_UNONAME_ASIANVERT"AsianVerticalMode",ATTR_VERTICAL_ASIAN,cppu::UnoType<bool>::get(), 0, 0 }, | |||
84 | {u"" SC_UNONAME_BOTTBORDER"BottomBorder",ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, BOTTOM_BORDER4 | CONVERT_TWIPS0x80 }, | |||
85 | {u"" SC_UNONAME_BOTTBORDER2"BottomBorder2",ATTR_BORDER, ::cppu::UnoType<table::BorderLine2>::get(), 0, BOTTOM_BORDER4 | CONVERT_TWIPS0x80 }, | |||
86 | {u"" SC_UNONAME_CELLBACK"CellBackColor", ATTR_BACKGROUND, ::cppu::UnoType<sal_Int32>::get(), 0, MID_BACK_COLOR0 }, | |||
87 | {u"" SC_UNONAME_CELLPRO"CellProtection", ATTR_PROTECTION, ::cppu::UnoType<util::CellProtection>::get(), 0, 0 }, | |||
88 | {u"" SC_UNONAME_CCOLOR"CharColor", ATTR_FONT_COLOR, ::cppu::UnoType<sal_Int32>::get(), 0, 0 }, | |||
89 | {u"" SC_UNONAME_COUTL"CharContoured", ATTR_FONT_CONTOUR, cppu::UnoType<bool>::get(), 0, 0 }, | |||
90 | {u"" SC_UNONAME_CCROSS"CharCrossedOut", ATTR_FONT_CROSSEDOUT,cppu::UnoType<bool>::get(), 0, MID_CROSSED_OUT0 }, | |||
91 | {u"" SC_UNONAME_CEMPHAS"CharEmphasis", ATTR_FONT_EMPHASISMARK,cppu::UnoType<sal_Int16>::get(), 0, MID_EMPHASIS0 }, | |||
92 | {u"" SC_UNONAME_CFONT"CharFont", ATTR_FONT, ::cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_FAMILY3 }, | |||
93 | {u"" SC_UNONAME_CFCHARS"CharFontCharSet", ATTR_FONT, cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_CHAR_SET4 }, | |||
94 | {u"" SC_UNO_CJK_CFCHARS"CharFontCharSetAsian", ATTR_CJK_FONT, cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_CHAR_SET4 }, | |||
95 | {u"" SC_UNO_CTL_CFCHARS"CharFontCharSetComplex", ATTR_CTL_FONT, cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_CHAR_SET4 }, | |||
96 | {u"" SC_UNONAME_CFFAMIL"CharFontFamily", ATTR_FONT, cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_FAMILY3 }, | |||
97 | {u"" SC_UNO_CJK_CFFAMIL"CharFontFamilyAsian", ATTR_CJK_FONT, cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_FAMILY3 }, | |||
98 | {u"" SC_UNO_CTL_CFFAMIL"CharFontFamilyComplex", ATTR_CTL_FONT, cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_FAMILY3 }, | |||
99 | {u"" SC_UNONAME_CFNAME"CharFontName", ATTR_FONT, cppu::UnoType<OUString>::get(), 0, MID_FONT_FAMILY_NAME1 }, | |||
100 | {u"" SC_UNO_CJK_CFNAME"CharFontNameAsian", ATTR_CJK_FONT, cppu::UnoType<OUString>::get(), 0, MID_FONT_FAMILY_NAME1 }, | |||
101 | {u"" SC_UNO_CTL_CFNAME"CharFontNameComplex", ATTR_CTL_FONT, cppu::UnoType<OUString>::get(), 0, MID_FONT_FAMILY_NAME1 }, | |||
102 | {u"" SC_UNONAME_CFPITCH"CharFontPitch", ATTR_FONT, cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_PITCH5 }, | |||
103 | {u"" SC_UNO_CJK_CFPITCH"CharFontPitchAsian", ATTR_CJK_FONT, cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_PITCH5 }, | |||
104 | {u"" SC_UNO_CTL_CFPITCH"CharFontPitchComplex", ATTR_CTL_FONT, cppu::UnoType<sal_Int16>::get(), 0, MID_FONT_PITCH5 }, | |||
105 | {u"" SC_UNONAME_CFSTYLE"CharFontStyleName", ATTR_FONT, cppu::UnoType<OUString>::get(), 0, MID_FONT_STYLE_NAME2 }, | |||
106 | {u"" SC_UNO_CJK_CFSTYLE"CharFontStyleNameAsian", ATTR_CJK_FONT, cppu::UnoType<OUString>::get(), 0, MID_FONT_STYLE_NAME2 }, | |||
107 | {u"" SC_UNO_CTL_CFSTYLE"CharFontStyleNameComplex", ATTR_CTL_FONT, cppu::UnoType<OUString>::get(), 0, MID_FONT_STYLE_NAME2 }, | |||
108 | {u"" SC_UNONAME_CHEIGHT"CharHeight", ATTR_FONT_HEIGHT, ::cppu::UnoType<float>::get(), 0, MID_FONTHEIGHT1 | CONVERT_TWIPS0x80 }, | |||
109 | {u"" SC_UNO_CJK_CHEIGHT"CharHeightAsian", ATTR_CJK_FONT_HEIGHT,::cppu::UnoType<float>::get(), 0, MID_FONTHEIGHT1 | CONVERT_TWIPS0x80 }, | |||
110 | {u"" SC_UNO_CTL_CHEIGHT"CharHeightComplex", ATTR_CTL_FONT_HEIGHT,::cppu::UnoType<float>::get(), 0, MID_FONTHEIGHT1 | CONVERT_TWIPS0x80 }, | |||
111 | {u"" SC_UNONAME_CLOCAL"CharLocale", ATTR_FONT_LANGUAGE, ::cppu::UnoType<lang::Locale>::get(), 0, MID_LANG_LOCALE1 }, | |||
112 | {u"" SC_UNO_CJK_CLOCAL"CharLocaleAsian", ATTR_CJK_FONT_LANGUAGE,::cppu::UnoType<lang::Locale>::get(), 0, MID_LANG_LOCALE1 }, | |||
113 | {u"" SC_UNO_CTL_CLOCAL"CharLocaleComplex", ATTR_CTL_FONT_LANGUAGE,::cppu::UnoType<lang::Locale>::get(), 0, MID_LANG_LOCALE1 }, | |||
114 | {u"" SC_UNONAME_COVER"CharOverline", ATTR_FONT_OVERLINE, ::cppu::UnoType<sal_Int16>::get(), 0, MID_TL_STYLE1 }, | |||
115 | {u"" SC_UNONAME_COVRLCOL"CharOverlineColor", ATTR_FONT_OVERLINE, cppu::UnoType<sal_Int32>::get(), 0, MID_TL_COLOR2 }, | |||
116 | {u"" SC_UNONAME_COVRLHAS"CharOverlineHasColor", ATTR_FONT_OVERLINE, cppu::UnoType<bool>::get(), 0, MID_TL_HASCOLOR3 }, | |||
117 | {u"" SC_UNONAME_CPOST"CharPosture", ATTR_FONT_POSTURE, ::cppu::UnoType<awt::FontSlant>::get(), 0, MID_POSTURE1 }, | |||
118 | {u"" SC_UNO_CJK_CPOST"CharPostureAsian", ATTR_CJK_FONT_POSTURE,::cppu::UnoType<awt::FontSlant>::get(), 0, MID_POSTURE1 }, | |||
119 | {u"" SC_UNO_CTL_CPOST"CharPostureComplex", ATTR_CTL_FONT_POSTURE,::cppu::UnoType<awt::FontSlant>::get(), 0, MID_POSTURE1 }, | |||
120 | {u"" SC_UNONAME_CRELIEF"CharRelief", ATTR_FONT_RELIEF, cppu::UnoType<sal_Int16>::get(), 0, MID_RELIEF0 }, | |||
121 | {u"" SC_UNONAME_CSHADD"CharShadowed", ATTR_FONT_SHADOWED, cppu::UnoType<bool>::get(), 0, 0 }, | |||
122 | {u"" SC_UNONAME_CSTRIKE"CharStrikeout", ATTR_FONT_CROSSEDOUT,cppu::UnoType<sal_Int16>::get(), 0, MID_CROSS_OUT1 }, | |||
123 | {u"" SC_UNONAME_CUNDER"CharUnderline", ATTR_FONT_UNDERLINE,::cppu::UnoType<sal_Int16>::get(), 0, MID_TL_STYLE1 }, | |||
124 | {u"" SC_UNONAME_CUNDLCOL"CharUnderlineColor", ATTR_FONT_UNDERLINE,cppu::UnoType<sal_Int32>::get(), 0, MID_TL_COLOR2 }, | |||
125 | {u"" SC_UNONAME_CUNDLHAS"CharUnderlineHasColor", ATTR_FONT_UNDERLINE,cppu::UnoType<bool>::get(), 0, MID_TL_HASCOLOR3 }, | |||
126 | {u"" SC_UNONAME_CWEIGHT"CharWeight", ATTR_FONT_WEIGHT, ::cppu::UnoType<float>::get(), 0, MID_WEIGHT1 }, | |||
127 | {u"" SC_UNO_CJK_CWEIGHT"CharWeightAsian", ATTR_CJK_FONT_WEIGHT,::cppu::UnoType<float>::get(), 0, MID_WEIGHT1 }, | |||
128 | {u"" SC_UNO_CTL_CWEIGHT"CharWeightComplex", ATTR_CTL_FONT_WEIGHT,::cppu::UnoType<float>::get(), 0, MID_WEIGHT1 }, | |||
129 | {u"" SC_UNONAME_CWORDMOD"CharWordMode", ATTR_FONT_WORDLINE, cppu::UnoType<bool>::get(), 0, 0 }, | |||
130 | {u"" SC_UNONAME_DIAGONAL_BLTR"DiagonalBLTR", ATTR_BORDER_BLTR, ::cppu::UnoType<table::BorderLine>::get(), 0, 0 | CONVERT_TWIPS0x80 }, | |||
131 | {u"" SC_UNONAME_DIAGONAL_BLTR2"DiagonalBLTR2", ATTR_BORDER_BLTR, ::cppu::UnoType<table::BorderLine2>::get(), 0, 0 | CONVERT_TWIPS0x80 }, | |||
132 | {u"" SC_UNONAME_DIAGONAL_TLBR"DiagonalTLBR", ATTR_BORDER_TLBR, ::cppu::UnoType<table::BorderLine>::get(), 0, 0 | CONVERT_TWIPS0x80 }, | |||
133 | {u"" SC_UNONAME_DIAGONAL_TLBR2"DiagonalTLBR2", ATTR_BORDER_TLBR, ::cppu::UnoType<table::BorderLine2>::get(), 0, 0 | CONVERT_TWIPS0x80 }, | |||
134 | {u"" SC_UNONAME_DISPNAME"DisplayName", SC_WID_UNO_DISPNAME( 1200 + 25 ),::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::READONLY, 0 }, | |||
135 | {u"" SC_UNONAME_CELLHJUS"HoriJustify", ATTR_HOR_JUSTIFY, ::cppu::UnoType<table::CellHoriJustify>::get(), 0, MID_HORJUST_HORJUST0 }, | |||
136 | {u"" SC_UNONAME_CELLHJUS_METHOD"HoriJustifyMethod", ATTR_HOR_JUSTIFY_METHOD, ::cppu::UnoType<sal_Int32>::get(), 0, 0 }, | |||
137 | {u"" SC_UNONAME_CELLTRAN"IsCellBackgroundTransparent", ATTR_BACKGROUND, cppu::UnoType<bool>::get(), 0, MID_GRAPHIC_TRANSPARENT3 }, | |||
138 | {u"" SC_UNONAME_WRAP"IsTextWrapped", ATTR_LINEBREAK, cppu::UnoType<bool>::get(), 0, 0 }, | |||
139 | {u"" SC_UNONAME_LEFTBORDER"LeftBorder",ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, LEFT_BORDER1 | CONVERT_TWIPS0x80 }, | |||
140 | {u"" SC_UNONAME_LEFTBORDER2"LeftBorder2",ATTR_BORDER, ::cppu::UnoType<table::BorderLine2>::get(), 0, LEFT_BORDER1 | CONVERT_TWIPS0x80 }, | |||
141 | {u"" SC_UNONAME_NUMFMT"NumberFormat", ATTR_VALUE_FORMAT, ::cppu::UnoType<sal_Int32>::get(), 0, 0 }, | |||
142 | // {SC_UNONAME_NUMRULES, SC_WID_UNO_NUMRULES,cppu::UnoType<container::XIndexReplace>::get(), 0, 0 }, | |||
143 | {u"" SC_UNONAME_CELLORI"Orientation", ATTR_STACKED, ::cppu::UnoType<table::CellOrientation>::get(), 0, 0 }, | |||
144 | {u"" SC_UNONAME_PADJUST"ParaAdjust", ATTR_HOR_JUSTIFY, ::cppu::UnoType<sal_Int16>::get(), 0, MID_HORJUST_ADJUST1 }, | |||
145 | {u"" SC_UNONAME_PBMARGIN"ParaBottomMargin", ATTR_MARGIN, ::cppu::UnoType<sal_Int32>::get(), 0, MID_MARGIN_LO_MARGIN5 | CONVERT_TWIPS0x80 }, | |||
146 | {u"" SC_UNONAME_PINDENT"ParaIndent", ATTR_INDENT, ::cppu::UnoType<sal_Int16>::get(), 0, 0 }, //! CONVERT_TWIPS | |||
147 | {u"" SC_UNONAME_PISCHDIST"ParaIsCharacterDistance",ATTR_SCRIPTSPACE, cppu::UnoType<bool>::get(), 0, 0 }, | |||
148 | {u"" SC_UNONAME_PISFORBID"ParaIsForbiddenRules",ATTR_FORBIDDEN_RULES,cppu::UnoType<bool>::get(), 0, 0 }, | |||
149 | {u"" SC_UNONAME_PISHANG"ParaIsHangingPunctuation", ATTR_HANGPUNCTUATION,cppu::UnoType<bool>::get(), 0, 0 }, | |||
150 | {u"" SC_UNONAME_PISHYPHEN"ParaIsHyphenation",ATTR_HYPHENATE, cppu::UnoType<bool>::get(), 0, 0 }, | |||
151 | {u"" SC_UNONAME_PLASTADJ"ParaLastLineAdjust", ATTR_HOR_JUSTIFY, ::cppu::UnoType<sal_Int16>::get(), 0, MID_HORJUST_ADJUST1 }, | |||
152 | {u"" SC_UNONAME_PLMARGIN"ParaLeftMargin", ATTR_MARGIN, ::cppu::UnoType<sal_Int32>::get(), 0, MID_MARGIN_L_MARGIN2 | CONVERT_TWIPS0x80 }, | |||
153 | {u"" SC_UNONAME_PRMARGIN"ParaRightMargin", ATTR_MARGIN, ::cppu::UnoType<sal_Int32>::get(), 0, MID_MARGIN_R_MARGIN3 | CONVERT_TWIPS0x80 }, | |||
154 | {u"" SC_UNONAME_PTMARGIN"ParaTopMargin", ATTR_MARGIN, ::cppu::UnoType<sal_Int32>::get(), 0, MID_MARGIN_UP_MARGIN4 | CONVERT_TWIPS0x80 }, | |||
155 | {u"" SC_UNONAME_RIGHTBORDER"RightBorder",ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, RIGHT_BORDER2 | CONVERT_TWIPS0x80 }, | |||
156 | {u"" SC_UNONAME_RIGHTBORDER2"RightBorder2",ATTR_BORDER, ::cppu::UnoType<table::BorderLine2>::get(), 0, RIGHT_BORDER2 | CONVERT_TWIPS0x80 }, | |||
157 | {u"" SC_UNONAME_ROTANG"RotateAngle", ATTR_ROTATE_VALUE, ::cppu::UnoType<sal_Int32>::get(), 0, 0 }, | |||
158 | {u"" SC_UNONAME_ROTREF"RotateReference", ATTR_ROTATE_MODE, ::cppu::UnoType<sal_Int32>::get(), 0, 0 }, | |||
159 | {u"" SC_UNONAME_SHADOW"ShadowFormat", ATTR_SHADOW, ::cppu::UnoType<table::ShadowFormat>::get(), 0, 0 | CONVERT_TWIPS0x80 }, | |||
160 | {u"" SC_UNONAME_SHRINK_TO_FIT"ShrinkToFit", ATTR_SHRINKTOFIT, cppu::UnoType<bool>::get(), 0, 0 }, | |||
161 | {u"" SC_UNONAME_TBLBORD"TableBorder", SC_WID_UNO_TBLBORD( 1200 + 6 ), ::cppu::UnoType<table::TableBorder>::get(), 0, 0 | CONVERT_TWIPS0x80 }, | |||
162 | {u"" SC_UNONAME_TBLBORD"TableBorder", SC_WID_UNO_TBLBORD2( 1200 + 43 ), ::cppu::UnoType<table::TableBorder2>::get(), 0, 0 | CONVERT_TWIPS0x80 }, | |||
163 | {u"" SC_UNONAME_TOPBORDER"TopBorder",ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, TOP_BORDER3 | CONVERT_TWIPS0x80 }, | |||
164 | {u"" SC_UNONAME_TOPBORDER2"TopBorder2",ATTR_BORDER, ::cppu::UnoType<table::BorderLine2>::get(), 0, TOP_BORDER3 | CONVERT_TWIPS0x80 }, | |||
165 | {u"" SC_UNONAME_USERDEF"UserDefinedAttributes", ATTR_USERDEF, cppu::UnoType<container::XNameContainer>::get(), 0, 0 }, | |||
166 | {u"" SC_UNONAME_CELLVJUS"VertJustify", ATTR_VER_JUSTIFY, ::cppu::UnoType<sal_Int32>::get(), 0, 0 }, | |||
167 | {u"" SC_UNONAME_CELLVJUS_METHOD"VertJustifyMethod", ATTR_VER_JUSTIFY_METHOD, ::cppu::UnoType<sal_Int32>::get(), 0, 0 }, | |||
168 | {u"" SC_UNONAME_WRITING"WritingMode", ATTR_WRITINGDIR, cppu::UnoType<sal_Int16>::get(), 0, 0 }, | |||
169 | {u"" SC_UNONAME_HIDDEN"Hidden", ATTR_HIDDEN, cppu::UnoType<sal_Bool>::get(), 0, 0 }, | |||
170 | {u"" SC_UNONAME_HYPERLINK"Hyperlink", ATTR_HYPERLINK, cppu::UnoType<OUString>::get(), 0, 0 }, | |||
171 | { u"", 0, css::uno::Type(), 0, 0 } | |||
172 | }; | |||
173 | static SfxItemPropertySet aCellStyleSet_Impl( aCellStyleMap_Impl ); | |||
174 | return &aCellStyleSet_Impl; | |||
175 | } | |||
176 | ||||
177 | // map with all site attributes including header and footer attributes | |||
178 | ||||
179 | static const SfxItemPropertySet * lcl_GetPageStyleSet() | |||
180 | { | |||
181 | static const SfxItemPropertyMapEntry aPageStyleMap_Impl[] = | |||
182 | { | |||
183 | {u"" SC_UNO_PAGE_BACKCOLOR"BackColor", ATTR_BACKGROUND, ::cppu::UnoType<sal_Int32>::get(), 0, MID_BACK_COLOR0 }, | |||
184 | {u"" SC_UNO_PAGE_GRAPHICFILT"BackGraphicFilter", ATTR_BACKGROUND, ::cppu::UnoType<OUString>::get(), 0, MID_GRAPHIC_FILTER5 }, | |||
185 | {u"" SC_UNO_PAGE_GRAPHICLOC"BackGraphicLocation", ATTR_BACKGROUND, ::cppu::UnoType<style::GraphicLocation>::get(), 0, MID_GRAPHIC_POSITION1 }, | |||
186 | {u"" SC_UNO_PAGE_GRAPHICURL"BackGraphicURL", ATTR_BACKGROUND, ::cppu::UnoType<OUString>::get(), 0, MID_GRAPHIC_URL4 }, | |||
187 | {u"" SC_UNO_PAGE_GRAPHIC"BackGraphic", ATTR_BACKGROUND, ::cppu::UnoType<graphic::XGraphic>::get(), 0, MID_GRAPHIC2 }, | |||
188 | {u"" SC_UNO_PAGE_BACKTRANS"BackTransparent", ATTR_BACKGROUND, cppu::UnoType<bool>::get(), 0, MID_GRAPHIC_TRANSPARENT3 }, | |||
189 | {u"" OLD_UNO_PAGE_BACKCOLOR"BackgroundColor", ATTR_BACKGROUND, ::cppu::UnoType<sal_Int32>::get(), 0, MID_BACK_COLOR0 }, | |||
190 | {u"" SC_UNO_PAGE_BORDERDIST"BorderDistance", ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, BORDER_DISTANCE5 | CONVERT_TWIPS0x80 }, | |||
191 | {u"" SC_UNO_PAGE_BOTTBORDER"BottomBorder", ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, BOTTOM_BORDER4 | CONVERT_TWIPS0x80 }, | |||
192 | {u"" SC_UNO_PAGE_BOTTBRDDIST"BottomBorderDistance", ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, BOTTOM_BORDER_DISTANCE9 | CONVERT_TWIPS0x80 }, | |||
193 | {u"" SC_UNO_PAGE_BOTTMARGIN"BottomMargin", ATTR_ULSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_LO_MARGIN4 | CONVERT_TWIPS0x80 }, | |||
194 | {u"" SC_UNO_PAGE_CENTERHOR"CenterHorizontally", ATTR_PAGE_HORCENTER,cppu::UnoType<bool>::get(), 0, 0 }, | |||
195 | {u"" SC_UNO_PAGE_CENTERVER"CenterVertically", ATTR_PAGE_VERCENTER,cppu::UnoType<bool>::get(), 0, 0 }, | |||
196 | {u"" SC_UNONAME_DISPNAME"DisplayName", SC_WID_UNO_DISPNAME( 1200 + 25 ),::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::READONLY, 0 }, | |||
197 | {u"" SC_UNO_PAGE_FIRSTPAGE"FirstPageNumber", ATTR_PAGE_FIRSTPAGENO,::cppu::UnoType<sal_Int16>::get(), 0, 0 }, | |||
198 | ||||
199 | {u"" SC_UNO_PAGE_FTRBACKCOL"FooterBackColor", SC_WID_UNO_FOOTERSET( 1200 + 27 ),::cppu::UnoType<sal_Int32>::get(), 0, 0 }, | |||
200 | {u"" SC_UNO_PAGE_FTRGRFFILT"FooterBackGraphicFilter", SC_WID_UNO_FOOTERSET( 1200 + 27 ),::cppu::UnoType<OUString>::get(), 0, 0 }, | |||
201 | {u"" SC_UNO_PAGE_FTRGRFLOC"FooterBackGraphicLocation", SC_WID_UNO_FOOTERSET( 1200 + 27 ),::cppu::UnoType<style::GraphicLocation>::get(), 0, 0 }, | |||
202 | {u"" SC_UNO_PAGE_FTRGRFURL"FooterBackGraphicURL", SC_WID_UNO_FOOTERSET( 1200 + 27 ),::cppu::UnoType<OUString>::get(), 0, 0 }, | |||
203 | {u"" SC_UNO_PAGE_FTRGRF"FooterBackGraphic", SC_WID_UNO_FOOTERSET( 1200 + 27 ),::cppu::UnoType<graphic::XGraphic>::get(), 0, 0 }, | |||
204 | {u"" SC_UNO_PAGE_FTRBACKTRAN"FooterBackTransparent", SC_WID_UNO_FOOTERSET( 1200 + 27 ),cppu::UnoType<bool>::get(), 0, 0 }, | |||
205 | {u"" OLD_UNO_PAGE_FTRBACKCOL"FooterBackgroundColor", SC_WID_UNO_FOOTERSET( 1200 + 27 ),::cppu::UnoType<sal_Int32>::get(), 0, 0 }, | |||
206 | {u"" SC_UNO_PAGE_FTRBODYDIST"FooterBodyDistance", SC_WID_UNO_FOOTERSET( 1200 + 27 ),::cppu::UnoType<sal_Int32>::get(), 0, 0 }, | |||
207 | {u"" SC_UNO_PAGE_FTRBRDDIST"FooterBorderDistance", SC_WID_UNO_FOOTERSET( 1200 + 27 ),::cppu::UnoType<sal_Int32>::get(), 0, 0 }, | |||
208 | {u"" SC_UNO_PAGE_FTRBOTTBOR"FooterBottomBorder", SC_WID_UNO_FOOTERSET( 1200 + 27 ),::cppu::UnoType<table::BorderLine>::get(), 0, 0 }, | |||
209 | {u"" SC_UNO_PAGE_FTRBOTTBDIS"FooterBottomBorderDistance", SC_WID_UNO_FOOTERSET( 1200 + 27 ),::cppu::UnoType<sal_Int32>::get(), 0, 0 }, | |||
210 | {u"" OLD_UNO_PAGE_FTRDYNAMIC"FooterDynamic", SC_WID_UNO_FOOTERSET( 1200 + 27 ),cppu::UnoType<bool>::get(), 0, 0 }, | |||
211 | {u"" SC_UNO_PAGE_FTRHEIGHT"FooterHeight", SC_WID_UNO_FOOTERSET( 1200 + 27 ),::cppu::UnoType<sal_Int32>::get(), 0, 0 }, | |||
212 | {u"" SC_UNO_PAGE_FTRDYNAMIC"FooterIsDynamicHeight", SC_WID_UNO_FOOTERSET( 1200 + 27 ),cppu::UnoType<bool>::get(), 0, 0 }, | |||
213 | {u"" SC_UNO_PAGE_FTRON"FooterIsOn", SC_WID_UNO_FOOTERSET( 1200 + 27 ),cppu::UnoType<bool>::get(), 0, 0 }, | |||
214 | {u"" SC_UNO_PAGE_FTRSHARED"FooterIsShared", SC_WID_UNO_FOOTERSET( 1200 + 27 ),cppu::UnoType<bool>::get(), 0, 0 }, | |||
215 | {u"" SC_UNO_PAGE_FTRLEFTBOR"FooterLeftBorder", SC_WID_UNO_FOOTERSET( 1200 + 27 ),::cppu::UnoType<table::BorderLine>::get(), 0, 0 }, | |||
216 | {u"" SC_UNO_PAGE_FTRLEFTBDIS"FooterLeftBorderDistance", SC_WID_UNO_FOOTERSET( 1200 + 27 ),::cppu::UnoType<sal_Int32>::get(), 0, 0 }, | |||
217 | {u"" SC_UNO_PAGE_FTRLEFTMAR"FooterLeftMargin", SC_WID_UNO_FOOTERSET( 1200 + 27 ),::cppu::UnoType<sal_Int32>::get(), 0, 0 }, | |||
218 | {u"" OLD_UNO_PAGE_FTRON"FooterOn", SC_WID_UNO_FOOTERSET( 1200 + 27 ),cppu::UnoType<bool>::get(), 0, 0 }, | |||
219 | {u"" SC_UNO_PAGE_FTRRIGHTBOR"FooterRightBorder", SC_WID_UNO_FOOTERSET( 1200 + 27 ),::cppu::UnoType<table::BorderLine>::get(), 0, 0 }, | |||
220 | {u"" SC_UNO_PAGE_FTRRIGHTBDIS"FooterRightBorderDistance",SC_WID_UNO_FOOTERSET( 1200 + 27 ),::cppu::UnoType<sal_Int32>::get(), 0, 0 }, | |||
221 | {u"" SC_UNO_PAGE_FTRRIGHTMAR"FooterRightMargin", SC_WID_UNO_FOOTERSET( 1200 + 27 ),::cppu::UnoType<sal_Int32>::get(), 0, 0 }, | |||
222 | {u"" SC_UNO_PAGE_FTRSHADOW"FooterShadowFormat", SC_WID_UNO_FOOTERSET( 1200 + 27 ),::cppu::UnoType<table::ShadowFormat>::get(), 0, 0 }, | |||
223 | {u"" OLD_UNO_PAGE_FTRSHARED"FooterShared", SC_WID_UNO_FOOTERSET( 1200 + 27 ),cppu::UnoType<bool>::get(), 0, 0 }, | |||
224 | {u"" SC_UNO_PAGE_FTRTOPBOR"FooterTopBorder", SC_WID_UNO_FOOTERSET( 1200 + 27 ),::cppu::UnoType<table::BorderLine>::get(), 0, 0 }, | |||
225 | {u"" SC_UNO_PAGE_FTRTOPBDIS"FooterTopBorderDistance", SC_WID_UNO_FOOTERSET( 1200 + 27 ),::cppu::UnoType<sal_Int32>::get(), 0, 0 }, | |||
226 | ||||
227 | {u"" SC_UNO_PAGE_HDRBACKCOL"HeaderBackColor", SC_WID_UNO_HEADERSET( 1200 + 26 ),::cppu::UnoType<sal_Int32>::get(), 0, 0 }, | |||
228 | {u"" SC_UNO_PAGE_HDRGRFFILT"HeaderBackGraphicFilter", SC_WID_UNO_HEADERSET( 1200 + 26 ),::cppu::UnoType<OUString>::get(), 0, 0 }, | |||
229 | {u"" SC_UNO_PAGE_HDRGRFLOC"HeaderBackGraphicLocation", SC_WID_UNO_HEADERSET( 1200 + 26 ),::cppu::UnoType<style::GraphicLocation>::get(), 0, 0 }, | |||
230 | {u"" SC_UNO_PAGE_HDRGRFURL"HeaderBackGraphicURL", SC_WID_UNO_HEADERSET( 1200 + 26 ),::cppu::UnoType<OUString>::get(), 0, 0 }, | |||
231 | {u"" SC_UNO_PAGE_HDRGRF"HeaderBackGraphic", SC_WID_UNO_HEADERSET( 1200 + 26 ),::cppu::UnoType<graphic::XGraphic>::get(), 0, 0 }, | |||
232 | {u"" SC_UNO_PAGE_HDRBACKTRAN"HeaderBackTransparent", SC_WID_UNO_HEADERSET( 1200 + 26 ),cppu::UnoType<bool>::get(), 0, 0 }, | |||
233 | {u"" OLD_UNO_PAGE_HDRBACKCOL"HeaderBackgroundColor", SC_WID_UNO_HEADERSET( 1200 + 26 ),::cppu::UnoType<sal_Int32>::get(), 0, 0 }, | |||
234 | {u"" SC_UNO_PAGE_HDRBODYDIST"HeaderBodyDistance", SC_WID_UNO_HEADERSET( 1200 + 26 ),::cppu::UnoType<sal_Int32>::get(), 0, 0 }, | |||
235 | {u"" SC_UNO_PAGE_HDRBRDDIST"HeaderBorderDistance", SC_WID_UNO_HEADERSET( 1200 + 26 ),::cppu::UnoType<sal_Int32>::get(), 0, 0 }, | |||
236 | {u"" SC_UNO_PAGE_HDRBOTTBOR"HeaderBottomBorder", SC_WID_UNO_HEADERSET( 1200 + 26 ),::cppu::UnoType<table::BorderLine>::get(), 0, 0 }, | |||
237 | {u"" SC_UNO_PAGE_HDRBOTTBDIS"HeaderBottomBorderDistance", SC_WID_UNO_HEADERSET( 1200 + 26 ),::cppu::UnoType<sal_Int32>::get(), 0, 0 }, | |||
238 | {u"" OLD_UNO_PAGE_HDRDYNAMIC"HeaderDynamic", SC_WID_UNO_HEADERSET( 1200 + 26 ),cppu::UnoType<bool>::get(), 0, 0 }, | |||
239 | {u"" SC_UNO_PAGE_HDRHEIGHT"HeaderHeight", SC_WID_UNO_HEADERSET( 1200 + 26 ),::cppu::UnoType<sal_Int32>::get(), 0, 0 }, | |||
240 | {u"" SC_UNO_PAGE_HDRDYNAMIC"HeaderIsDynamicHeight", SC_WID_UNO_HEADERSET( 1200 + 26 ),cppu::UnoType<bool>::get(), 0, 0 }, | |||
241 | {u"" SC_UNO_PAGE_HDRON"HeaderIsOn", SC_WID_UNO_HEADERSET( 1200 + 26 ),cppu::UnoType<bool>::get(), 0, 0 }, | |||
242 | {u"" SC_UNO_PAGE_HDRSHARED"HeaderIsShared", SC_WID_UNO_HEADERSET( 1200 + 26 ),cppu::UnoType<bool>::get(), 0, 0 }, | |||
243 | {u"" SC_UNO_PAGE_HDRLEFTBOR"HeaderLeftBorder", SC_WID_UNO_HEADERSET( 1200 + 26 ),::cppu::UnoType<table::BorderLine>::get(), 0, 0 }, | |||
244 | {u"" SC_UNO_PAGE_HDRLEFTBDIS"HeaderLeftBorderDistance", SC_WID_UNO_HEADERSET( 1200 + 26 ),::cppu::UnoType<sal_Int32>::get(), 0, 0 }, | |||
245 | {u"" SC_UNO_PAGE_HDRLEFTMAR"HeaderLeftMargin", SC_WID_UNO_HEADERSET( 1200 + 26 ),::cppu::UnoType<sal_Int32>::get(), 0, 0 }, | |||
246 | {u"" OLD_UNO_PAGE_HDRON"HeaderOn", SC_WID_UNO_HEADERSET( 1200 + 26 ),cppu::UnoType<bool>::get(), 0, 0 }, | |||
247 | {u"" SC_UNO_PAGE_HDRRIGHTBOR"HeaderRightBorder", SC_WID_UNO_HEADERSET( 1200 + 26 ),::cppu::UnoType<table::BorderLine>::get(), 0, 0 }, | |||
248 | {u"" SC_UNO_PAGE_HDRRIGHTBDIS"HeaderRightBorderDistance",SC_WID_UNO_HEADERSET( 1200 + 26 ),::cppu::UnoType<sal_Int32>::get(), 0, 0 }, | |||
249 | {u"" SC_UNO_PAGE_HDRRIGHTMAR"HeaderRightMargin", SC_WID_UNO_HEADERSET( 1200 + 26 ),::cppu::UnoType<sal_Int32>::get(), 0, 0 }, | |||
250 | {u"" SC_UNO_PAGE_HDRSHADOW"HeaderShadowFormat", SC_WID_UNO_HEADERSET( 1200 + 26 ),::cppu::UnoType<table::ShadowFormat>::get(), 0, 0 }, | |||
251 | {u"" OLD_UNO_PAGE_HDRSHARED"HeaderShared", SC_WID_UNO_HEADERSET( 1200 + 26 ),cppu::UnoType<bool>::get(), 0, 0 }, | |||
252 | {u"" SC_UNO_PAGE_HDRTOPBOR"HeaderTopBorder", SC_WID_UNO_HEADERSET( 1200 + 26 ),::cppu::UnoType<table::BorderLine>::get(), 0, 0 }, | |||
253 | {u"" SC_UNO_PAGE_HDRTOPBDIS"HeaderTopBorderDistance", SC_WID_UNO_HEADERSET( 1200 + 26 ),::cppu::UnoType<sal_Int32>::get(), 0, 0 }, | |||
254 | ||||
255 | {u"" SC_UNO_PAGE_HEIGHT"Height", ATTR_PAGE_SIZE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_SIZE_HEIGHT2 | CONVERT_TWIPS0x80 }, | |||
256 | {u"" OLD_UNO_PAGE_BACKTRANS"IsBackgroundTransparent", ATTR_BACKGROUND, cppu::UnoType<bool>::get(), 0, MID_GRAPHIC_TRANSPARENT3 }, | |||
257 | {u"" SC_UNO_PAGE_LANDSCAPE"IsLandscape", ATTR_PAGE, cppu::UnoType<bool>::get(), 0, MID_PAGE_ORIENTATION1 }, | |||
258 | {u"" SC_UNO_PAGE_LEFTBORDER"LeftBorder", ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, LEFT_BORDER1 | CONVERT_TWIPS0x80 }, | |||
259 | {u"" SC_UNO_PAGE_LEFTBRDDIST"LeftBorderDistance", ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, LEFT_BORDER_DISTANCE6 | CONVERT_TWIPS0x80 }, | |||
260 | {u"" SC_UNO_PAGE_LEFTMARGIN"LeftMargin", ATTR_LRSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_L_MARGIN4 | CONVERT_TWIPS0x80 }, | |||
261 | {u"" SC_UNO_PAGE_LEFTFTRCONT"LeftPageFooterContent", ATTR_PAGE_FOOTERLEFT,cppu::UnoType<sheet::XHeaderFooterContent>::get(), 0, 0 }, | |||
262 | {u"" SC_UNO_PAGE_LEFTHDRCONT"LeftPageHeaderContent", ATTR_PAGE_HEADERLEFT,cppu::UnoType<sheet::XHeaderFooterContent>::get(), 0, 0 }, | |||
263 | {u"" SC_UNO_PAGE_NUMBERTYPE"NumberingType", ATTR_PAGE, ::cppu::UnoType<sal_Int16>::get(), 0, MID_PAGE_NUMTYPE0 }, | |||
264 | {u"" SC_UNO_PAGE_SCALEVAL"PageScale", ATTR_PAGE_SCALE, ::cppu::UnoType<sal_Int16>::get(), 0, 0 }, | |||
265 | {u"" SC_UNO_PAGE_SYTLELAYOUT"PageStyleLayout", ATTR_PAGE, ::cppu::UnoType<style::PageStyleLayout>::get(), 0, MID_PAGE_LAYOUT2 }, | |||
266 | {u"" SC_UNO_PAGE_PRINTANNOT"PrintAnnotations", ATTR_PAGE_NOTES, cppu::UnoType<bool>::get(), 0, 0 }, | |||
267 | {u"" SC_UNO_PAGE_PRINTCHARTS"PrintCharts", ATTR_PAGE_CHARTS, cppu::UnoType<bool>::get(), 0, 0 }, | |||
268 | {u"" SC_UNO_PAGE_PRINTDOWN"PrintDownFirst", ATTR_PAGE_TOPDOWN, cppu::UnoType<bool>::get(), 0, 0 }, | |||
269 | {u"" SC_UNO_PAGE_PRINTDRAW"PrintDrawing", ATTR_PAGE_DRAWINGS, cppu::UnoType<bool>::get(), 0, 0 }, | |||
270 | {u"" SC_UNO_PAGE_PRINTFORMUL"PrintFormulas", ATTR_PAGE_FORMULAS, cppu::UnoType<bool>::get(), 0, 0 }, | |||
271 | {u"" SC_UNO_PAGE_PRINTGRID"PrintGrid", ATTR_PAGE_GRID, cppu::UnoType<bool>::get(), 0, 0 }, | |||
272 | {u"" SC_UNO_PAGE_PRINTHEADER"PrintHeaders", ATTR_PAGE_HEADERS, cppu::UnoType<bool>::get(), 0, 0 }, | |||
273 | {u"" SC_UNO_PAGE_PRINTOBJS"PrintObjects", ATTR_PAGE_OBJECTS, cppu::UnoType<bool>::get(), 0, 0 }, | |||
274 | {u"" SC_UNO_PAGE_PRINTZERO"PrintZeroValues", ATTR_PAGE_NULLVALS, cppu::UnoType<bool>::get(), 0, 0 }, | |||
275 | {u"" SC_UNO_PAGE_PAPERTRAY"PrinterPaperTray", ATTR_PAGE_PAPERBIN, ::cppu::UnoType<OUString>::get(), 0, 0 }, | |||
276 | {u"" SC_UNO_PAGE_RIGHTBORDER"RightBorder", ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, RIGHT_BORDER2 | CONVERT_TWIPS0x80 }, | |||
277 | {u"" SC_UNO_PAGE_RIGHTBRDDIST"RightBorderDistance",ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, RIGHT_BORDER_DISTANCE7 | CONVERT_TWIPS0x80 }, | |||
278 | {u"" SC_UNO_PAGE_RIGHTMARGIN"RightMargin", ATTR_LRSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_R_MARGIN5 | CONVERT_TWIPS0x80 }, | |||
279 | {u"" SC_UNO_PAGE_RIGHTFTRCON"RightPageFooterContent", ATTR_PAGE_FOOTERRIGHT,cppu::UnoType<sheet::XHeaderFooterContent>::get(), 0, 0 }, | |||
280 | {u"" SC_UNO_PAGE_RIGHTHDRCON"RightPageHeaderContent", ATTR_PAGE_HEADERRIGHT,cppu::UnoType<sheet::XHeaderFooterContent>::get(), 0, 0 }, | |||
281 | {u"" SC_UNO_PAGE_SCALETOPAG"ScaleToPages", ATTR_PAGE_SCALETOPAGES,::cppu::UnoType<sal_Int16>::get(), 0, 0 }, | |||
282 | {u"" SC_UNO_PAGE_SCALETOX"ScaleToPagesX", ATTR_PAGE_SCALETO, ::cppu::UnoType<sal_Int16>::get(), 0, 0 }, | |||
283 | {u"" SC_UNO_PAGE_SCALETOY"ScaleToPagesY", ATTR_PAGE_SCALETO, ::cppu::UnoType<sal_Int16>::get(), 0, 0 }, | |||
284 | {u"" SC_UNO_PAGE_SHADOWFORM"ShadowFormat", ATTR_SHADOW, ::cppu::UnoType<table::ShadowFormat>::get(), 0, 0 | CONVERT_TWIPS0x80 }, | |||
285 | {u"" SC_UNO_PAGE_SIZE"Size", ATTR_PAGE_SIZE, ::cppu::UnoType<awt::Size>::get(), 0, MID_SIZE_SIZE0 | CONVERT_TWIPS0x80 }, | |||
286 | {u"" SC_UNO_PAGE_TOPBORDER"TopBorder", ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, TOP_BORDER3 | CONVERT_TWIPS0x80 }, | |||
287 | {u"" SC_UNO_PAGE_TOPBRDDIST"TopBorderDistance", ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, TOP_BORDER_DISTANCE8 | CONVERT_TWIPS0x80 }, | |||
288 | {u"" SC_UNO_PAGE_TOPMARGIN"TopMargin", ATTR_ULSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_UP_MARGIN3 | CONVERT_TWIPS0x80 }, | |||
289 | {u"" OLD_UNO_PAGE_FTRBACKTRAN"TransparentFooterBackground",SC_WID_UNO_FOOTERSET( 1200 + 27 ),cppu::UnoType<bool>::get(), 0, 0 }, | |||
290 | {u"" OLD_UNO_PAGE_HDRBACKTRAN"TransparentHeaderBackground",SC_WID_UNO_HEADERSET( 1200 + 26 ),cppu::UnoType<bool>::get(), 0, 0 }, | |||
291 | {u"" SC_UNONAME_USERDEF"UserDefinedAttributes", ATTR_USERDEF, cppu::UnoType<container::XNameContainer>::get(), 0, 0 }, | |||
292 | {u"" SC_UNO_PAGE_WIDTH"Width", ATTR_PAGE_SIZE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_SIZE_WIDTH1 | CONVERT_TWIPS0x80 }, | |||
293 | {u"" SC_UNONAME_WRITING"WritingMode", ATTR_WRITINGDIR, cppu::UnoType<sal_Int16>::get(), 0, 0 }, | |||
294 | {u"" SC_UNONAME_HIDDEN"Hidden", ATTR_HIDDEN, cppu::UnoType<sal_Bool>::get(), 0, 0 }, | |||
295 | { u"", 0, css::uno::Type(), 0, 0 } | |||
296 | }; | |||
297 | static SfxItemPropertySet aPageStyleSet_Impl( aPageStyleMap_Impl ); | |||
298 | return &aPageStyleSet_Impl; | |||
299 | } | |||
300 | ||||
301 | // map with content of the Header-Item-Sets | |||
302 | ||||
303 | static const SfxItemPropertyMap* lcl_GetHeaderStyleMap() | |||
304 | { | |||
305 | static const SfxItemPropertyMapEntry aHeaderStyleMap_Impl[] = | |||
306 | { | |||
307 | {u"" SC_UNO_PAGE_HDRBACKCOL"HeaderBackColor", ATTR_BACKGROUND, ::cppu::UnoType<sal_Int32>::get(), 0, MID_BACK_COLOR0 }, | |||
308 | {u"" SC_UNO_PAGE_HDRGRFFILT"HeaderBackGraphicFilter", ATTR_BACKGROUND, ::cppu::UnoType<OUString>::get(), 0, MID_GRAPHIC_FILTER5 }, | |||
309 | {u"" SC_UNO_PAGE_HDRGRFLOC"HeaderBackGraphicLocation", ATTR_BACKGROUND, ::cppu::UnoType<style::GraphicLocation>::get(), 0, MID_GRAPHIC_POSITION1 }, | |||
310 | {u"" SC_UNO_PAGE_HDRGRFURL"HeaderBackGraphicURL", ATTR_BACKGROUND, ::cppu::UnoType<OUString>::get(), 0, MID_GRAPHIC_URL4 }, | |||
311 | {u"" SC_UNO_PAGE_HDRGRF"HeaderBackGraphic", ATTR_BACKGROUND, ::cppu::UnoType<graphic::XGraphic>::get(), 0, MID_GRAPHIC2 }, | |||
312 | {u"" SC_UNO_PAGE_HDRBACKTRAN"HeaderBackTransparent", ATTR_BACKGROUND, cppu::UnoType<bool>::get(), 0, MID_GRAPHIC_TRANSPARENT3 }, | |||
313 | {u"" OLD_UNO_PAGE_HDRBACKCOL"HeaderBackgroundColor", ATTR_BACKGROUND, ::cppu::UnoType<sal_Int32>::get(), 0, MID_BACK_COLOR0 }, | |||
314 | {u"" SC_UNO_PAGE_HDRBODYDIST"HeaderBodyDistance", ATTR_ULSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_LO_MARGIN4 | CONVERT_TWIPS0x80 }, | |||
315 | {u"" SC_UNO_PAGE_HDRBRDDIST"HeaderBorderDistance", ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, BORDER_DISTANCE5 | CONVERT_TWIPS0x80 }, | |||
316 | {u"" SC_UNO_PAGE_HDRBOTTBOR"HeaderBottomBorder", ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, BOTTOM_BORDER4 | CONVERT_TWIPS0x80 }, | |||
317 | {u"" SC_UNO_PAGE_HDRBOTTBDIS"HeaderBottomBorderDistance", ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, BOTTOM_BORDER_DISTANCE9 | CONVERT_TWIPS0x80 }, | |||
318 | {u"" OLD_UNO_PAGE_HDRDYNAMIC"HeaderDynamic", ATTR_PAGE_DYNAMIC, cppu::UnoType<bool>::get(), 0, 0 }, | |||
319 | {u"" SC_UNO_PAGE_HDRHEIGHT"HeaderHeight", ATTR_PAGE_SIZE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_SIZE_HEIGHT2 | CONVERT_TWIPS0x80 }, | |||
320 | {u"" SC_UNO_PAGE_HDRDYNAMIC"HeaderIsDynamicHeight", ATTR_PAGE_DYNAMIC, cppu::UnoType<bool>::get(), 0, 0 }, | |||
321 | {u"" SC_UNO_PAGE_HDRON"HeaderIsOn", ATTR_PAGE_ON, cppu::UnoType<bool>::get(), 0, 0 }, | |||
322 | {u"" SC_UNO_PAGE_HDRSHARED"HeaderIsShared", ATTR_PAGE_SHARED, cppu::UnoType<bool>::get(), 0, 0 }, | |||
323 | {u"" SC_UNO_PAGE_HDRLEFTBOR"HeaderLeftBorder", ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, LEFT_BORDER1 | CONVERT_TWIPS0x80 }, | |||
324 | {u"" SC_UNO_PAGE_HDRLEFTBDIS"HeaderLeftBorderDistance", ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, LEFT_BORDER_DISTANCE6 | CONVERT_TWIPS0x80 }, | |||
325 | {u"" SC_UNO_PAGE_HDRLEFTMAR"HeaderLeftMargin", ATTR_LRSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_L_MARGIN4 | CONVERT_TWIPS0x80 }, | |||
326 | {u"" OLD_UNO_PAGE_HDRON"HeaderOn", ATTR_PAGE_ON, cppu::UnoType<bool>::get(), 0, 0 }, | |||
327 | {u"" SC_UNO_PAGE_HDRRIGHTBOR"HeaderRightBorder", ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, RIGHT_BORDER2 | CONVERT_TWIPS0x80 }, | |||
328 | {u"" SC_UNO_PAGE_HDRRIGHTBDIS"HeaderRightBorderDistance",ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, RIGHT_BORDER_DISTANCE7 | CONVERT_TWIPS0x80 }, | |||
329 | {u"" SC_UNO_PAGE_HDRRIGHTMAR"HeaderRightMargin", ATTR_LRSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_R_MARGIN5 | CONVERT_TWIPS0x80 }, | |||
330 | {u"" SC_UNO_PAGE_HDRSHADOW"HeaderShadowFormat", ATTR_SHADOW, ::cppu::UnoType<table::ShadowFormat>::get(), 0, 0 | CONVERT_TWIPS0x80 }, | |||
331 | {u"" OLD_UNO_PAGE_HDRSHARED"HeaderShared", ATTR_PAGE_SHARED, cppu::UnoType<bool>::get(), 0, 0 }, | |||
332 | {u"" SC_UNO_PAGE_HDRTOPBOR"HeaderTopBorder", ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, TOP_BORDER3 | CONVERT_TWIPS0x80 }, | |||
333 | {u"" SC_UNO_PAGE_HDRTOPBDIS"HeaderTopBorderDistance", ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, TOP_BORDER_DISTANCE8 | CONVERT_TWIPS0x80 }, | |||
334 | {u"" OLD_UNO_PAGE_HDRBACKTRAN"TransparentHeaderBackground",ATTR_BACKGROUND, cppu::UnoType<bool>::get(), 0, MID_GRAPHIC_TRANSPARENT3 }, | |||
335 | { u"", 0, css::uno::Type(), 0, 0 } | |||
336 | }; | |||
337 | static SfxItemPropertyMap aHeaderStyleMap( aHeaderStyleMap_Impl ); | |||
338 | return &aHeaderStyleMap; | |||
339 | } | |||
340 | ||||
341 | // map with content of the Footer-Item-Sets | |||
342 | ||||
343 | static const SfxItemPropertyMap* lcl_GetFooterStyleMap() | |||
344 | { | |||
345 | static const SfxItemPropertyMapEntry aFooterStyleMap_Impl[] = | |||
346 | { | |||
347 | {u"" SC_UNO_PAGE_FTRBACKCOL"FooterBackColor", ATTR_BACKGROUND, ::cppu::UnoType<sal_Int32>::get(), 0, MID_BACK_COLOR0 }, | |||
348 | {u"" SC_UNO_PAGE_FTRGRFFILT"FooterBackGraphicFilter", ATTR_BACKGROUND, ::cppu::UnoType<OUString>::get(), 0, MID_GRAPHIC_FILTER5 }, | |||
349 | {u"" SC_UNO_PAGE_FTRGRFLOC"FooterBackGraphicLocation", ATTR_BACKGROUND, ::cppu::UnoType<style::GraphicLocation>::get(), 0, MID_GRAPHIC_POSITION1 }, | |||
350 | {u"" SC_UNO_PAGE_FTRGRFURL"FooterBackGraphicURL", ATTR_BACKGROUND, ::cppu::UnoType<OUString>::get(), 0, MID_GRAPHIC_URL4 }, | |||
351 | {u"" SC_UNO_PAGE_FTRGRF"FooterBackGraphic", ATTR_BACKGROUND, ::cppu::UnoType<graphic::XGraphic>::get(), 0, MID_GRAPHIC2 }, | |||
352 | {u"" SC_UNO_PAGE_FTRBACKTRAN"FooterBackTransparent", ATTR_BACKGROUND, cppu::UnoType<bool>::get(), 0, MID_GRAPHIC_TRANSPARENT3 }, | |||
353 | {u"" OLD_UNO_PAGE_FTRBACKCOL"FooterBackgroundColor", ATTR_BACKGROUND, ::cppu::UnoType<sal_Int32>::get(), 0, MID_BACK_COLOR0 }, | |||
354 | {u"" SC_UNO_PAGE_FTRBODYDIST"FooterBodyDistance", ATTR_ULSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_UP_MARGIN3 | CONVERT_TWIPS0x80 }, | |||
355 | {u"" SC_UNO_PAGE_FTRBRDDIST"FooterBorderDistance", ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, BORDER_DISTANCE5 | CONVERT_TWIPS0x80 }, | |||
356 | {u"" SC_UNO_PAGE_FTRBOTTBOR"FooterBottomBorder", ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, BOTTOM_BORDER4 | CONVERT_TWIPS0x80 }, | |||
357 | {u"" SC_UNO_PAGE_FTRBOTTBDIS"FooterBottomBorderDistance", ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, BOTTOM_BORDER_DISTANCE9 | CONVERT_TWIPS0x80 }, | |||
358 | {u"" OLD_UNO_PAGE_FTRDYNAMIC"FooterDynamic", ATTR_PAGE_DYNAMIC, cppu::UnoType<bool>::get(), 0, 0 }, | |||
359 | {u"" SC_UNO_PAGE_FTRHEIGHT"FooterHeight", ATTR_PAGE_SIZE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_SIZE_HEIGHT2 | CONVERT_TWIPS0x80 }, | |||
360 | {u"" SC_UNO_PAGE_FTRDYNAMIC"FooterIsDynamicHeight", ATTR_PAGE_DYNAMIC, cppu::UnoType<bool>::get(), 0, 0 }, | |||
361 | {u"" SC_UNO_PAGE_FTRON"FooterIsOn", ATTR_PAGE_ON, cppu::UnoType<bool>::get(), 0, 0 }, | |||
362 | {u"" SC_UNO_PAGE_FTRSHARED"FooterIsShared", ATTR_PAGE_SHARED, cppu::UnoType<bool>::get(), 0, 0 }, | |||
363 | {u"" SC_UNO_PAGE_FTRLEFTBOR"FooterLeftBorder", ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, LEFT_BORDER1 | CONVERT_TWIPS0x80 }, | |||
364 | {u"" SC_UNO_PAGE_FTRLEFTBDIS"FooterLeftBorderDistance", ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, LEFT_BORDER_DISTANCE6 | CONVERT_TWIPS0x80 }, | |||
365 | {u"" SC_UNO_PAGE_FTRLEFTMAR"FooterLeftMargin", ATTR_LRSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_L_MARGIN4 | CONVERT_TWIPS0x80 }, | |||
366 | {u"" OLD_UNO_PAGE_FTRON"FooterOn", ATTR_PAGE_ON, cppu::UnoType<bool>::get(), 0, 0 }, | |||
367 | {u"" SC_UNO_PAGE_FTRRIGHTBOR"FooterRightBorder", ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, RIGHT_BORDER2 | CONVERT_TWIPS0x80 }, | |||
368 | {u"" SC_UNO_PAGE_FTRRIGHTBDIS"FooterRightBorderDistance",ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, RIGHT_BORDER_DISTANCE7 | CONVERT_TWIPS0x80 }, | |||
369 | {u"" SC_UNO_PAGE_FTRRIGHTMAR"FooterRightMargin", ATTR_LRSPACE, ::cppu::UnoType<sal_Int32>::get(), 0, MID_R_MARGIN5 | CONVERT_TWIPS0x80 }, | |||
370 | {u"" SC_UNO_PAGE_FTRSHADOW"FooterShadowFormat", ATTR_SHADOW, ::cppu::UnoType<table::ShadowFormat>::get(), 0, 0 | CONVERT_TWIPS0x80 }, | |||
371 | {u"" OLD_UNO_PAGE_FTRSHARED"FooterShared", ATTR_PAGE_SHARED, cppu::UnoType<bool>::get(), 0, 0 }, | |||
372 | {u"" SC_UNO_PAGE_FTRTOPBOR"FooterTopBorder", ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, TOP_BORDER3 | CONVERT_TWIPS0x80 }, | |||
373 | {u"" SC_UNO_PAGE_FTRTOPBDIS"FooterTopBorderDistance", ATTR_BORDER, ::cppu::UnoType<sal_Int32>::get(), 0, TOP_BORDER_DISTANCE8 | CONVERT_TWIPS0x80 }, | |||
374 | {u"" OLD_UNO_PAGE_FTRBACKTRAN"TransparentFooterBackground",ATTR_BACKGROUND, cppu::UnoType<bool>::get(), 0, MID_GRAPHIC_TRANSPARENT3 }, | |||
375 | { u"", 0, css::uno::Type(), 0, 0 } | |||
376 | }; | |||
377 | static SfxItemPropertyMap aFooterStyleMap( aFooterStyleMap_Impl ); | |||
378 | return &aFooterStyleMap; | |||
379 | } | |||
380 | ||||
381 | // access index on the style types: 0 = Cell, 1 = Page | |||
382 | ||||
383 | #define SC_STYLE_FAMILY_COUNT2 2 | |||
384 | ||||
385 | #define SC_FAMILYNAME_CELL"CellStyles" "CellStyles" | |||
386 | #define SC_FAMILYNAME_PAGE"PageStyles" "PageStyles" | |||
387 | ||||
388 | const SfxStyleFamily aStyleFamilyTypes[SC_STYLE_FAMILY_COUNT2] = { SfxStyleFamily::Para, SfxStyleFamily::Page }; | |||
389 | ||||
390 | using sc::HMMToTwips; | |||
391 | using sc::TwipsToHMM; | |||
392 | ||||
393 | #define SCSTYLE_SERVICE"com.sun.star.style.Style" "com.sun.star.style.Style" | |||
394 | #define SCCELLSTYLE_SERVICE"com.sun.star.style.CellStyle" "com.sun.star.style.CellStyle" | |||
395 | #define SCPAGESTYLE_SERVICE"com.sun.star.style.PageStyle" "com.sun.star.style.PageStyle" | |||
396 | ||||
397 | SC_SIMPLE_SERVICE_INFO( ScStyleFamiliesObj, "ScStyleFamiliesObj", "com.sun.star.style.StyleFamilies" )OUString ScStyleFamiliesObj::getImplementationName() { return "ScStyleFamiliesObj"; } sal_Bool ScStyleFamiliesObj::supportsService ( const OUString& ServiceName ) { return cppu::supportsService (this, ServiceName); } css::uno::Sequence< OUString > ScStyleFamiliesObj ::getSupportedServiceNames() { css::uno::Sequence< OUString > aRet { "com.sun.star.style.StyleFamilies" }; return aRet ; } | |||
398 | SC_SIMPLE_SERVICE_INFO( ScStyleFamilyObj, "ScStyleFamilyObj", "com.sun.star.style.StyleFamily" )OUString ScStyleFamilyObj::getImplementationName() { return "ScStyleFamilyObj" ; } sal_Bool ScStyleFamilyObj::supportsService( const OUString & ServiceName ) { return cppu::supportsService(this, ServiceName ); } css::uno::Sequence< OUString > ScStyleFamilyObj::getSupportedServiceNames () { css::uno::Sequence< OUString > aRet { "com.sun.star.style.StyleFamily" }; return aRet; } | |||
399 | ||||
400 | #define SC_PAPERBIN_DEFAULTNAME"[From printer settings]" "[From printer settings]" | |||
401 | ||||
402 | static bool lcl_AnyTabProtected( const ScDocument& rDoc ) | |||
403 | { | |||
404 | SCTAB nTabCount = rDoc.GetTableCount(); | |||
405 | for (SCTAB i=0; i<nTabCount; i++) | |||
406 | if (rDoc.IsTabProtected(i)) | |||
407 | return true; | |||
408 | return false; | |||
409 | } | |||
410 | ||||
411 | ScStyleFamiliesObj::ScStyleFamiliesObj(ScDocShell* pDocSh) : | |||
412 | pDocShell( pDocSh ) | |||
413 | { | |||
414 | pDocShell->GetDocument().AddUnoObject(*this); | |||
415 | } | |||
416 | ||||
417 | ScStyleFamiliesObj::~ScStyleFamiliesObj() | |||
418 | { | |||
419 | SolarMutexGuard g; | |||
420 | ||||
421 | if (pDocShell) | |||
422 | pDocShell->GetDocument().RemoveUnoObject(*this); | |||
423 | } | |||
424 | ||||
425 | void ScStyleFamiliesObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) | |||
426 | { | |||
427 | // reference update does not matter here | |||
428 | ||||
429 | if ( rHint.GetId() == SfxHintId::Dying ) | |||
430 | { | |||
431 | pDocShell = nullptr; | |||
432 | } | |||
433 | } | |||
434 | ||||
435 | // XStyleFamilies | |||
436 | ||||
437 | ScStyleFamilyObj*ScStyleFamiliesObj::GetObjectByType_Impl(SfxStyleFamily nType) const | |||
438 | { | |||
439 | if ( pDocShell ) | |||
440 | { | |||
441 | if ( nType == SfxStyleFamily::Para ) | |||
442 | return new ScStyleFamilyObj( pDocShell, SfxStyleFamily::Para ); | |||
443 | else if ( nType == SfxStyleFamily::Page ) | |||
444 | return new ScStyleFamilyObj( pDocShell, SfxStyleFamily::Page ); | |||
445 | } | |||
446 | OSL_FAIL("getStyleFamilyByType: no DocShell or wrong SfxStyleFamily")do { if (true && (((sal_Bool)1))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/sc/source/ui/unoobj/styleuno.cxx" ":" "446" ": "), "%s", "getStyleFamilyByType: no DocShell or wrong SfxStyleFamily" ); } } while (false); | |||
447 | return nullptr; | |||
448 | } | |||
449 | ||||
450 | ScStyleFamilyObj* ScStyleFamiliesObj::GetObjectByIndex_Impl(sal_uInt32 nIndex) const | |||
451 | { | |||
452 | if ( nIndex < SC_STYLE_FAMILY_COUNT2 ) | |||
453 | return GetObjectByType_Impl(aStyleFamilyTypes[nIndex]); | |||
454 | ||||
455 | return nullptr; // invalid index | |||
456 | } | |||
457 | ||||
458 | ScStyleFamilyObj* ScStyleFamiliesObj::GetObjectByName_Impl(const OUString& aName) const | |||
459 | { | |||
460 | if ( pDocShell ) | |||
461 | { | |||
462 | if ( aName == SC_FAMILYNAME_CELL"CellStyles" ) | |||
463 | return new ScStyleFamilyObj( pDocShell, SfxStyleFamily::Para ); | |||
464 | else if ( aName == SC_FAMILYNAME_PAGE"PageStyles" ) | |||
465 | return new ScStyleFamilyObj( pDocShell, SfxStyleFamily::Page ); | |||
466 | } | |||
467 | // no assertion - called directly from getByName | |||
468 | return nullptr; | |||
469 | } | |||
470 | ||||
471 | // container::XIndexAccess | |||
472 | ||||
473 | sal_Int32 SAL_CALL ScStyleFamiliesObj::getCount() | |||
474 | { | |||
475 | return SC_STYLE_FAMILY_COUNT2; | |||
476 | } | |||
477 | ||||
478 | uno::Any SAL_CALL ScStyleFamiliesObj::getByIndex( sal_Int32 nIndex ) | |||
479 | { | |||
480 | SolarMutexGuard aGuard; | |||
481 | uno::Reference< container::XNameContainer > xFamily(GetObjectByIndex_Impl(nIndex)); | |||
482 | if (!xFamily.is()) | |||
483 | throw lang::IndexOutOfBoundsException(); | |||
484 | ||||
485 | return uno::makeAny(xFamily); | |||
486 | } | |||
487 | ||||
488 | uno::Type SAL_CALL ScStyleFamiliesObj::getElementType() | |||
489 | { | |||
490 | SolarMutexGuard aGuard; | |||
491 | return cppu::UnoType<container::XNameContainer>::get(); // has to fit to getByIndex | |||
492 | } | |||
493 | ||||
494 | sal_Bool SAL_CALL ScStyleFamiliesObj::hasElements() | |||
495 | { | |||
496 | SolarMutexGuard aGuard; | |||
497 | return ( getCount() != 0 ); | |||
498 | } | |||
499 | ||||
500 | // container::XNameAccess | |||
501 | ||||
502 | uno::Any SAL_CALL ScStyleFamiliesObj::getByName( const OUString& aName ) | |||
503 | { | |||
504 | SolarMutexGuard aGuard; | |||
505 | uno::Reference< container::XNameContainer > xFamily(GetObjectByName_Impl(aName)); | |||
506 | if (!xFamily.is()) | |||
507 | throw container::NoSuchElementException(); | |||
508 | ||||
509 | return uno::makeAny(xFamily); | |||
510 | } | |||
511 | ||||
512 | uno::Sequence<OUString> SAL_CALL ScStyleFamiliesObj::getElementNames() | |||
513 | { | |||
514 | return {SC_FAMILYNAME_CELL"CellStyles", SC_FAMILYNAME_PAGE"PageStyles"}; | |||
515 | } | |||
516 | ||||
517 | sal_Bool SAL_CALL ScStyleFamiliesObj::hasByName( const OUString& aName ) | |||
518 | { | |||
519 | return aName == SC_FAMILYNAME_CELL"CellStyles" || aName == SC_FAMILYNAME_PAGE"PageStyles"; | |||
520 | } | |||
521 | ||||
522 | // style::XStyleLoader | |||
523 | ||||
524 | void SAL_CALL ScStyleFamiliesObj::loadStylesFromURL( const OUString& aURL, | |||
525 | const uno::Sequence<beans::PropertyValue>& aOptions ) | |||
526 | { | |||
527 | //! use aOptions (like Writer) | |||
528 | //! set flag to disable filter option dialogs when importing | |||
529 | ||||
530 | OUString aFilter; // empty - detect | |||
531 | OUString aFiltOpt; | |||
532 | uno::Reference<io::XInputStream> xInputStream; | |||
533 | if (aURL == "private:stream") | |||
534 | { | |||
535 | for (const auto& rProp : aOptions) | |||
536 | { | |||
537 | if (rProp.Name == "InputStream") | |||
538 | { | |||
539 | rProp.Value >>= xInputStream; | |||
540 | if (!xInputStream.is()) | |||
541 | { | |||
542 | throw lang::IllegalArgumentException( | |||
543 | "Parameter 'InputStream' could not be converted " | |||
544 | "to type 'com::sun::star::io::XInputStream'", | |||
545 | nullptr, 0); | |||
546 | } | |||
547 | break; | |||
548 | } | |||
549 | } | |||
550 | } | |||
551 | ||||
552 | ScDocumentLoader aLoader( aURL, aFilter, aFiltOpt, 0, nullptr, xInputStream ); | |||
553 | ||||
554 | ScDocShell* pSource = aLoader.GetDocShell(); | |||
555 | ||||
556 | loadStylesFromDocShell(pSource, aOptions); | |||
557 | } | |||
558 | ||||
559 | uno::Sequence<beans::PropertyValue> SAL_CALL ScStyleFamiliesObj::getStyleLoaderOptions() | |||
560 | { | |||
561 | // return defaults for options (?) | |||
562 | return comphelper::InitPropertySequence({ | |||
563 | { SC_UNONAME_OVERWSTL"OverwriteStyles", uno::Any(true) }, | |||
564 | { SC_UNONAME_LOADCELL"LoadCellStyles", uno::Any(true) }, | |||
565 | { SC_UNONAME_LOADPAGE"LoadPageStyles", uno::Any(true) } | |||
566 | }); | |||
567 | } | |||
568 | ||||
569 | // style::XStyleLoader2 | |||
570 | ||||
571 | void SAL_CALL ScStyleFamiliesObj::loadStylesFromDocument( const uno::Reference < lang::XComponent > & aSourceComponent, | |||
572 | const uno::Sequence<beans::PropertyValue>& aOptions ) | |||
573 | { | |||
574 | // Source document docShell | |||
575 | if ( !aSourceComponent.is() ) | |||
576 | throw uno::RuntimeException(); | |||
577 | ||||
578 | ScDocShell* pDocShellSrc = dynamic_cast<ScDocShell*> (SfxObjectShell::GetShellFromComponent(aSourceComponent)); | |||
579 | ||||
580 | loadStylesFromDocShell(pDocShellSrc, aOptions); | |||
581 | } | |||
582 | ||||
583 | // private | |||
584 | ||||
585 | void ScStyleFamiliesObj::loadStylesFromDocShell( ScDocShell* pSource, | |||
586 | const uno::Sequence<beans::PropertyValue>& aOptions ) | |||
587 | { | |||
588 | ||||
589 | if ( !(pSource && pDocShell) ) | |||
590 | return; | |||
591 | ||||
592 | // collect options | |||
593 | ||||
594 | bool bLoadReplace = true; // defaults | |||
595 | bool bLoadCellStyles = true; | |||
596 | bool bLoadPageStyles = true; | |||
597 | ||||
598 | for (const beans::PropertyValue& rProp : aOptions) | |||
599 | { | |||
600 | OUString aPropName(rProp.Name); | |||
601 | ||||
602 | if (aPropName == SC_UNONAME_OVERWSTL"OverwriteStyles") | |||
603 | bLoadReplace = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value ); | |||
604 | else if (aPropName == SC_UNONAME_LOADCELL"LoadCellStyles") | |||
605 | bLoadCellStyles = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value ); | |||
606 | else if (aPropName == SC_UNONAME_LOADPAGE"LoadPageStyles") | |||
607 | bLoadPageStyles = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value ); | |||
608 | } | |||
609 | ||||
610 | pDocShell->LoadStylesArgs( *pSource, bLoadReplace, bLoadCellStyles, bLoadPageStyles ); | |||
611 | pDocShell->SetDocumentModified(); // paint is inside LoadStyles | |||
612 | } | |||
613 | ||||
614 | ScStyleFamilyObj::ScStyleFamilyObj(ScDocShell* pDocSh, SfxStyleFamily eFam) : | |||
615 | pDocShell( pDocSh ), | |||
616 | eFamily( eFam ) | |||
617 | { | |||
618 | pDocShell->GetDocument().AddUnoObject(*this); | |||
619 | } | |||
620 | ||||
621 | ScStyleFamilyObj::~ScStyleFamilyObj() | |||
622 | { | |||
623 | SolarMutexGuard g; | |||
624 | ||||
625 | if (pDocShell) | |||
626 | pDocShell->GetDocument().RemoveUnoObject(*this); | |||
627 | } | |||
628 | ||||
629 | void ScStyleFamilyObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) | |||
630 | { | |||
631 | // reference update does not matter here | |||
632 | ||||
633 | if ( rHint.GetId() == SfxHintId::Dying ) | |||
634 | { | |||
635 | pDocShell = nullptr; // has become invalid | |||
636 | } | |||
637 | } | |||
638 | ||||
639 | // XStyleFamily | |||
640 | ||||
641 | ScStyleObj* ScStyleFamilyObj::GetObjectByIndex_Impl(sal_uInt32 nIndex) | |||
642 | { | |||
643 | if ( pDocShell ) | |||
644 | { | |||
645 | ScDocument& rDoc = pDocShell->GetDocument(); | |||
646 | ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool(); | |||
647 | ||||
648 | SfxStyleSheetIterator aIter( pStylePool, eFamily ); | |||
649 | if ( nIndex < aIter.Count() ) | |||
650 | { | |||
651 | SfxStyleSheetBase* pStyle = aIter[static_cast<sal_uInt16>(nIndex)]; | |||
652 | if ( pStyle ) | |||
653 | { | |||
654 | return new ScStyleObj( pDocShell, eFamily, pStyle->GetName() ); | |||
655 | } | |||
656 | } | |||
657 | } | |||
658 | return nullptr; | |||
659 | } | |||
660 | ||||
661 | ScStyleObj* ScStyleFamilyObj::GetObjectByName_Impl(const OUString& aName) | |||
662 | { | |||
663 | if ( pDocShell ) | |||
664 | { | |||
665 | ScDocument& rDoc = pDocShell->GetDocument(); | |||
666 | ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool(); | |||
667 | if ( pStylePool->Find( aName, eFamily ) ) | |||
668 | return new ScStyleObj( pDocShell, eFamily, aName ); | |||
669 | } | |||
670 | return nullptr; | |||
671 | } | |||
672 | ||||
673 | void SAL_CALL ScStyleFamilyObj::insertByName( const OUString& aName, const uno::Any& aElement ) | |||
674 | { | |||
675 | SolarMutexGuard aGuard; | |||
676 | bool bDone = false; | |||
677 | // reflection does not need to be uno::XInterface, can be any interface... | |||
678 | uno::Reference< uno::XInterface > xInterface(aElement, uno::UNO_QUERY); | |||
679 | if ( xInterface.is() ) | |||
680 | { | |||
681 | ScStyleObj* pStyleObj = comphelper::getUnoTunnelImplementation<ScStyleObj>( xInterface ); | |||
682 | if ( pStyleObj && pStyleObj->GetFamily() == eFamily && | |||
683 | !pStyleObj->IsInserted() ) // not yet inserted? | |||
684 | { | |||
685 | OUString aNameStr(ScStyleNameConversion::ProgrammaticToDisplayName( aName, eFamily )); | |||
686 | ||||
687 | ScDocument& rDoc = pDocShell->GetDocument(); | |||
688 | ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool(); | |||
689 | ||||
690 | //! DocFunc function ??? | |||
691 | //! Undo ????????????? | |||
692 | ||||
693 | if ( pStylePool->Find( aNameStr, eFamily ) ) // not available yet | |||
694 | throw container::ElementExistException(); | |||
695 | ||||
696 | (void)pStylePool->Make( aNameStr, eFamily, SfxStyleSearchBits::UserDefined ); | |||
697 | ||||
698 | if ( eFamily == SfxStyleFamily::Para && !rDoc.IsImportingXML() ) | |||
699 | rDoc.GetPool()->CellStyleCreated( aNameStr, rDoc ); | |||
700 | ||||
701 | pStyleObj->InitDoc( pDocShell, aNameStr ); // object can be used | |||
702 | ||||
703 | if (!rDoc.IsImportingXML()) | |||
704 | pDocShell->SetDocumentModified(); // new style not used yet | |||
705 | bDone = true; | |||
706 | ||||
707 | } | |||
708 | } | |||
709 | ||||
710 | if (!bDone) | |||
711 | { | |||
712 | // other errors are handled above | |||
713 | throw lang::IllegalArgumentException(); | |||
714 | } | |||
715 | } | |||
716 | ||||
717 | void SAL_CALL ScStyleFamilyObj::replaceByName( const OUString& aName, const uno::Any& aElement ) | |||
718 | { | |||
719 | SolarMutexGuard aGuard; | |||
720 | //! combine? | |||
721 | removeByName( aName ); | |||
| ||||
722 | insertByName( aName, aElement ); | |||
723 | } | |||
724 | ||||
725 | void SAL_CALL ScStyleFamilyObj::removeByName( const OUString& aName ) | |||
726 | { | |||
727 | SolarMutexGuard aGuard; | |||
728 | bool bFound = false; | |||
729 | if ( pDocShell ) | |||
730 | { | |||
731 | OUString aString(ScStyleNameConversion::ProgrammaticToDisplayName( aName, eFamily )); | |||
732 | ||||
733 | ScDocument& rDoc = pDocShell->GetDocument(); | |||
734 | ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool(); | |||
735 | ||||
736 | //! DocFunc function?? | |||
737 | //! Undo ????????????? | |||
738 | ||||
739 | SfxStyleSheetBase* pStyle = pStylePool->Find( aString, eFamily ); | |||
740 | if (pStyle) | |||
741 | { | |||
742 | bFound = true; | |||
743 | if ( eFamily == SfxStyleFamily::Para ) | |||
744 | { | |||
745 | // like ScViewFunc::RemoveStyleSheetInUse | |||
746 | ScopedVclPtrInstance< VirtualDevice > pVDev; | |||
747 | Point aLogic = pVDev->LogicToPixel(Point(1000,1000), MapMode(MapUnit::MapTwip)); | |||
748 | double nPPTX = aLogic.X() / 1000.0; | |||
749 | double nPPTY = aLogic.Y() / 1000.0; | |||
750 | Fraction aZoom(1,1); | |||
751 | rDoc.StyleSheetChanged( pStyle, false, pVDev, nPPTX, nPPTY, aZoom, aZoom ); | |||
752 | pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left ); | |||
753 | pDocShell->SetDocumentModified(); | |||
754 | ||||
755 | pStylePool->Remove( pStyle ); | |||
756 | ||||
757 | //! InvalidateAttribs(); // Bindings-Invalidate | |||
758 | } | |||
759 | else | |||
760 | { | |||
761 | if ( rDoc.RemovePageStyleInUse( aString ) ) | |||
762 | pDocShell->PageStyleModified( ScResId(STR_STYLENAME_STANDARD_PAGEreinterpret_cast<char const *>("STR_STYLENAME_STANDARD" "\004" u8"Default Page Style")), true ); | |||
763 | ||||
764 | pStylePool->Remove( pStyle ); | |||
765 | ||||
766 | SfxBindings* pBindings = pDocShell->GetViewBindings(); | |||
767 | if (pBindings) | |||
768 | pBindings->Invalidate( SID_STYLE_FAMILY4((5000 + 541) + 3) ); | |||
769 | pDocShell->SetDocumentModified(); | |||
770 | } | |||
771 | } | |||
772 | } | |||
773 | ||||
774 | if (!bFound) | |||
775 | throw container::NoSuchElementException(); | |||
776 | } | |||
777 | ||||
778 | // container::XIndexAccess | |||
779 | ||||
780 | sal_Int32 SAL_CALL ScStyleFamilyObj::getCount() | |||
781 | { | |||
782 | SolarMutexGuard aGuard; | |||
783 | if ( pDocShell ) | |||
784 | { | |||
785 | ScDocument& rDoc = pDocShell->GetDocument(); | |||
786 | ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool(); | |||
787 | ||||
788 | SfxStyleSheetIterator aIter( pStylePool, eFamily ); | |||
789 | return aIter.Count(); | |||
790 | } | |||
791 | return 0; | |||
792 | } | |||
793 | ||||
794 | uno::Any SAL_CALL ScStyleFamilyObj::getByIndex( sal_Int32 nIndex ) | |||
795 | { | |||
796 | SolarMutexGuard aGuard; | |||
797 | uno::Reference< style::XStyle > xObj(GetObjectByIndex_Impl(nIndex)); | |||
798 | if (!xObj.is()) | |||
799 | throw lang::IndexOutOfBoundsException(); | |||
800 | ||||
801 | return uno::makeAny(xObj); | |||
802 | } | |||
803 | ||||
804 | uno::Type SAL_CALL ScStyleFamilyObj::getElementType() | |||
805 | { | |||
806 | SolarMutexGuard aGuard; | |||
807 | return cppu::UnoType<style::XStyle>::get(); // has to fit to getByIndex | |||
808 | } | |||
809 | ||||
810 | sal_Bool SAL_CALL ScStyleFamilyObj::hasElements() | |||
811 | { | |||
812 | SolarMutexGuard aGuard; | |||
813 | return ( getCount() != 0 ); | |||
814 | } | |||
815 | ||||
816 | // container::XNameAccess | |||
817 | ||||
818 | uno::Any SAL_CALL ScStyleFamilyObj::getByName( const OUString& aName ) | |||
819 | { | |||
820 | SolarMutexGuard aGuard; | |||
821 | uno::Reference< style::XStyle > xObj( | |||
822 | GetObjectByName_Impl( ScStyleNameConversion::ProgrammaticToDisplayName( aName, eFamily ) )); | |||
823 | if (!xObj.is()) | |||
824 | throw container::NoSuchElementException(); | |||
825 | ||||
826 | return uno::makeAny(xObj); | |||
827 | } | |||
828 | ||||
829 | uno::Sequence<OUString> SAL_CALL ScStyleFamilyObj::getElementNames() | |||
830 | { | |||
831 | SolarMutexGuard aGuard; | |||
832 | if ( pDocShell ) | |||
833 | { | |||
834 | ScDocument& rDoc = pDocShell->GetDocument(); | |||
835 | ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool(); | |||
836 | ||||
837 | SfxStyleSheetIterator aIter( pStylePool, eFamily ); | |||
838 | sal_uInt16 nCount = aIter.Count(); | |||
839 | ||||
840 | uno::Sequence<OUString> aSeq(nCount); | |||
841 | OUString* pAry = aSeq.getArray(); | |||
842 | SfxStyleSheetBase* pStyle = aIter.First(); | |||
843 | sal_uInt16 nPos = 0; | |||
844 | while (pStyle) | |||
845 | { | |||
846 | OSL_ENSURE( nPos < nCount, "Count is wrong" )do { if (true && (!(nPos < nCount))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/sc/source/ui/unoobj/styleuno.cxx" ":" "846" ": "), "%s", "Count is wrong"); } } while (false); | |||
847 | if (nPos < nCount) | |||
848 | pAry[nPos++] = ScStyleNameConversion::DisplayToProgrammaticName( | |||
849 | pStyle->GetName(), eFamily ); | |||
850 | pStyle = aIter.Next(); | |||
851 | } | |||
852 | return aSeq; | |||
853 | } | |||
854 | return uno::Sequence<OUString>(); | |||
855 | } | |||
856 | ||||
857 | sal_Bool SAL_CALL ScStyleFamilyObj::hasByName( const OUString& aName ) | |||
858 | { | |||
859 | SolarMutexGuard aGuard; | |||
860 | if ( pDocShell ) | |||
861 | { | |||
862 | OUString aString(ScStyleNameConversion::ProgrammaticToDisplayName( aName, eFamily )); | |||
863 | ||||
864 | ScDocument& rDoc = pDocShell->GetDocument(); | |||
865 | ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool(); | |||
866 | if ( pStylePool->Find( aString, eFamily ) ) | |||
867 | return true; | |||
868 | } | |||
869 | return false; | |||
870 | } | |||
871 | ||||
872 | // XPropertySet | |||
873 | ||||
874 | uno::Reference< beans::XPropertySetInfo > SAL_CALL ScStyleFamilyObj::getPropertySetInfo( ) | |||
875 | { | |||
876 | OSL_FAIL( "###unexpected!" )do { if (true && (((sal_Bool)1))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/sc/source/ui/unoobj/styleuno.cxx" ":" "876" ": "), "%s", "###unexpected!"); } } while (false); | |||
877 | return uno::Reference< beans::XPropertySetInfo >(); | |||
878 | } | |||
879 | ||||
880 | void SAL_CALL ScStyleFamilyObj::setPropertyValue( const OUString&, const uno::Any& ) | |||
881 | { | |||
882 | OSL_FAIL( "###unexpected!" )do { if (true && (((sal_Bool)1))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/sc/source/ui/unoobj/styleuno.cxx" ":" "882" ": "), "%s", "###unexpected!"); } } while (false); | |||
883 | } | |||
884 | ||||
885 | uno::Any SAL_CALL ScStyleFamilyObj::getPropertyValue( const OUString& sPropertyName ) | |||
886 | { | |||
887 | uno::Any aRet; | |||
888 | ||||
889 | if ( sPropertyName != "DisplayName" ) | |||
890 | { | |||
891 | throw beans::UnknownPropertyException( "unknown property: " + sPropertyName, static_cast<OWeakObject *>(this) ); | |||
892 | } | |||
893 | ||||
894 | SolarMutexGuard aGuard; | |||
895 | const char* pResId = nullptr; | |||
896 | switch ( eFamily ) | |||
897 | { | |||
898 | case SfxStyleFamily::Para: | |||
899 | pResId = STR_STYLE_FAMILY_CELLreinterpret_cast<char const *>("STR_STYLE_FAMILY_CELL" "\004" u8"Cell Styles"); break; | |||
900 | case SfxStyleFamily::Page: | |||
901 | pResId = STR_STYLE_FAMILY_PAGEreinterpret_cast<char const *>("STR_STYLE_FAMILY_PAGE" "\004" u8"Page Styles"); break; | |||
902 | default: | |||
903 | OSL_FAIL( "ScStyleFamilyObj::getPropertyValue(): invalid family" )do { if (true && (((sal_Bool)1))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/sc/source/ui/unoobj/styleuno.cxx" ":" "903" ": "), "%s", "ScStyleFamilyObj::getPropertyValue(): invalid family" ); } } while (false); | |||
904 | } | |||
905 | if (pResId) | |||
906 | { | |||
907 | OUString sDisplayName(ScResId(pResId)); | |||
908 | aRet <<= sDisplayName; | |||
909 | } | |||
910 | ||||
911 | return aRet; | |||
912 | } | |||
913 | ||||
914 | void SAL_CALL ScStyleFamilyObj::addPropertyChangeListener( const OUString&, const uno::Reference< beans::XPropertyChangeListener >& ) | |||
915 | { | |||
916 | OSL_FAIL( "###unexpected!" )do { if (true && (((sal_Bool)1))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/sc/source/ui/unoobj/styleuno.cxx" ":" "916" ": "), "%s", "###unexpected!"); } } while (false); | |||
917 | } | |||
918 | ||||
919 | void SAL_CALL ScStyleFamilyObj::removePropertyChangeListener( const OUString&, const uno::Reference< beans::XPropertyChangeListener >& ) | |||
920 | { | |||
921 | OSL_FAIL( "###unexpected!" )do { if (true && (((sal_Bool)1))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/sc/source/ui/unoobj/styleuno.cxx" ":" "921" ": "), "%s", "###unexpected!"); } } while (false); | |||
922 | } | |||
923 | ||||
924 | void SAL_CALL ScStyleFamilyObj::addVetoableChangeListener( const OUString&, const uno::Reference< beans::XVetoableChangeListener >& ) | |||
925 | { | |||
926 | OSL_FAIL( "###unexpected!" )do { if (true && (((sal_Bool)1))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/sc/source/ui/unoobj/styleuno.cxx" ":" "926" ": "), "%s", "###unexpected!"); } } while (false); | |||
927 | } | |||
928 | ||||
929 | void SAL_CALL ScStyleFamilyObj::removeVetoableChangeListener( const OUString&, const uno::Reference< beans::XVetoableChangeListener >& ) | |||
930 | { | |||
931 | OSL_FAIL( "###unexpected!" )do { if (true && (((sal_Bool)1))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/sc/source/ui/unoobj/styleuno.cxx" ":" "931" ": "), "%s", "###unexpected!"); } } while (false); | |||
932 | } | |||
933 | ||||
934 | // default ctor is needed for reflection | |||
935 | ||||
936 | ScStyleObj::ScStyleObj(ScDocShell* pDocSh, SfxStyleFamily eFam, const OUString& rName) | |||
937 | : pPropSet( (eFam == SfxStyleFamily::Para) ? lcl_GetCellStyleSet() : lcl_GetPageStyleSet() ) | |||
938 | , pDocShell(pDocSh) | |||
939 | , eFamily(eFam) | |||
940 | , aStyleName(rName) | |||
941 | , pStyle_cached(nullptr) | |||
942 | { | |||
943 | // if create by ServiceProvider then pDocShell is NULL | |||
944 | ||||
945 | if (pDocShell) | |||
946 | pDocShell->GetDocument().AddUnoObject(*this); | |||
947 | } | |||
948 | ||||
949 | void ScStyleObj::InitDoc( ScDocShell* pNewDocSh, const OUString& rNewName ) | |||
950 | { | |||
951 | if ( pNewDocSh && !pDocShell ) | |||
952 | { | |||
953 | aStyleName = rNewName; | |||
954 | pDocShell = pNewDocSh; | |||
955 | pDocShell->GetDocument().AddUnoObject(*this); | |||
956 | } | |||
957 | } | |||
958 | ||||
959 | ScStyleObj::~ScStyleObj() | |||
960 | { | |||
961 | SolarMutexGuard g; | |||
962 | ||||
963 | if (pDocShell) | |||
964 | pDocShell->GetDocument().RemoveUnoObject(*this); | |||
965 | } | |||
966 | ||||
967 | // XUnoTunnel | |||
968 | ||||
969 | UNO3_GETIMPLEMENTATION_IMPL(ScStyleObj)namespace { class theScStyleObjUnoTunnelId : public rtl::Static < UnoTunnelIdInit, theScStyleObjUnoTunnelId> {}; } const css::uno::Sequence< sal_Int8 > & ScStyleObj::getUnoTunnelId () throw() { return theScStyleObjUnoTunnelId::get().getSeq(); }sal_Int64 ScStyleObj::getSomething( const css::uno::Sequence < sal_Int8 >& rId ) { if( isUnoTunnelId<ScStyleObj >(rId) ) { return sal::static_int_cast<sal_Int64>(reinterpret_cast <sal_IntPtr>(this)); } return 0; }; | |||
970 | ||||
971 | void ScStyleObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) | |||
972 | { | |||
973 | // reference update does not matter here | |||
974 | ||||
975 | if ( rHint.GetId() == SfxHintId::Dying ) | |||
976 | { | |||
977 | pDocShell = nullptr; // has become invalid | |||
978 | } | |||
979 | } | |||
980 | ||||
981 | SfxStyleSheetBase* ScStyleObj::GetStyle_Impl( bool bUseCachedValue ) | |||
982 | { | |||
983 | if ( bUseCachedValue ) | |||
984 | return pStyle_cached; | |||
985 | ||||
986 | pStyle_cached = nullptr; | |||
987 | if ( pDocShell ) | |||
988 | { | |||
989 | ScDocument& rDoc = pDocShell->GetDocument(); | |||
990 | ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool(); | |||
991 | pStyle_cached = pStylePool->Find( aStyleName, eFamily ); | |||
992 | } | |||
993 | return pStyle_cached; | |||
994 | } | |||
995 | ||||
996 | // style::XStyle | |||
997 | ||||
998 | sal_Bool SAL_CALL ScStyleObj::isUserDefined() | |||
999 | { | |||
1000 | SolarMutexGuard aGuard; | |||
1001 | SfxStyleSheetBase* pStyle = GetStyle_Impl(); | |||
1002 | if (pStyle) | |||
1003 | return pStyle->IsUserDefined(); | |||
1004 | return false; | |||
1005 | } | |||
1006 | ||||
1007 | sal_Bool SAL_CALL ScStyleObj::isInUse() | |||
1008 | { | |||
1009 | SolarMutexGuard aGuard; | |||
1010 | SfxStyleSheetBase* pStyle = GetStyle_Impl(); | |||
1011 | if (pStyle) | |||
1012 | return pStyle->IsUsed(); | |||
1013 | return false; | |||
1014 | } | |||
1015 | ||||
1016 | OUString SAL_CALL ScStyleObj::getParentStyle() | |||
1017 | { | |||
1018 | SolarMutexGuard aGuard; | |||
1019 | SfxStyleSheetBase* pStyle = GetStyle_Impl(); | |||
1020 | if (pStyle) | |||
1021 | return ScStyleNameConversion::DisplayToProgrammaticName( pStyle->GetParent(), eFamily ); | |||
1022 | return OUString(); | |||
1023 | } | |||
1024 | ||||
1025 | void SAL_CALL ScStyleObj::setParentStyle( const OUString& rParentStyle ) | |||
1026 | { | |||
1027 | SolarMutexGuard aGuard; | |||
1028 | SfxStyleSheetBase* pStyle = GetStyle_Impl(); | |||
1029 | if (!pStyle) | |||
1030 | return; | |||
1031 | ||||
1032 | // cell styles cannot be modified if any sheet is protected | |||
1033 | if ( eFamily == SfxStyleFamily::Para && lcl_AnyTabProtected( pDocShell->GetDocument() ) ) | |||
1034 | return; //! exception? | |||
1035 | ||||
1036 | //! DocFunc function?? | |||
1037 | //! Undo ????????????? | |||
1038 | ||||
1039 | OUString aString(ScStyleNameConversion::ProgrammaticToDisplayName( rParentStyle, eFamily )); | |||
1040 | bool bOk = pStyle->SetParent( aString ); | |||
1041 | if (!bOk) | |||
1042 | return; | |||
1043 | ||||
1044 | // as by setPropertyValue | |||
1045 | ||||
1046 | ScDocument& rDoc = pDocShell->GetDocument(); | |||
1047 | if ( eFamily == SfxStyleFamily::Para ) | |||
1048 | { | |||
1049 | // update line height | |||
1050 | ||||
1051 | ScopedVclPtrInstance< VirtualDevice > pVDev; | |||
1052 | Point aLogic = pVDev->LogicToPixel( Point(1000,1000), MapMode(MapUnit::MapTwip)); | |||
1053 | double nPPTX = aLogic.X() / 1000.0; | |||
1054 | double nPPTY = aLogic.Y() / 1000.0; | |||
1055 | Fraction aZoom(1,1); | |||
1056 | rDoc.StyleSheetChanged( pStyle, false, pVDev, nPPTX, nPPTY, aZoom, aZoom ); | |||
1057 | ||||
1058 | if (!rDoc.IsImportingXML()) | |||
1059 | { | |||
1060 | pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left ); | |||
1061 | pDocShell->SetDocumentModified(); | |||
1062 | } | |||
1063 | } | |||
1064 | else | |||
1065 | { | |||
1066 | //! ModifyStyleSheet on document (save old values) | |||
1067 | ||||
1068 | pDocShell->PageStyleModified( aStyleName, true ); | |||
1069 | } | |||
1070 | } | |||
1071 | ||||
1072 | // container::XNamed | |||
1073 | ||||
1074 | OUString SAL_CALL ScStyleObj::getName() | |||
1075 | { | |||
1076 | SolarMutexGuard aGuard; | |||
1077 | SfxStyleSheetBase* pStyle = GetStyle_Impl(); | |||
1078 | if (pStyle) | |||
1079 | return ScStyleNameConversion::DisplayToProgrammaticName( pStyle->GetName(), eFamily ); | |||
1080 | return OUString(); | |||
1081 | } | |||
1082 | ||||
1083 | void SAL_CALL ScStyleObj::setName( const OUString& aNewName ) | |||
1084 | { | |||
1085 | SolarMutexGuard aGuard; | |||
1086 | SfxStyleSheetBase* pStyle = GetStyle_Impl(); | |||
1087 | if (!pStyle) | |||
1088 | return; | |||
1089 | ||||
1090 | // cell styles cannot be renamed if any sheet is protected | |||
1091 | if ( eFamily == SfxStyleFamily::Para && lcl_AnyTabProtected( pDocShell->GetDocument() ) ) | |||
1092 | return; //! exception? | |||
1093 | ||||
1094 | //! DocFunc function?? | |||
1095 | //! Undo ????????????? | |||
1096 | ||||
1097 | bool bOk = pStyle->SetName( aNewName ); | |||
1098 | if (!bOk) | |||
1099 | return; | |||
1100 | ||||
1101 | aStyleName = aNewName; //! notify other objects for this style? | |||
1102 | ||||
1103 | ScDocument& rDoc = pDocShell->GetDocument(); | |||
1104 | if ( eFamily == SfxStyleFamily::Para && !rDoc.IsImportingXML() ) | |||
1105 | rDoc.GetPool()->CellStyleCreated( aNewName, rDoc ); | |||
1106 | ||||
1107 | // cell styles = 2, page styles = 4 | |||
1108 | sal_uInt16 nId = ( eFamily == SfxStyleFamily::Para ) ? | |||
1109 | SID_STYLE_FAMILY2((5000 + 541) + 1) : SID_STYLE_FAMILY4((5000 + 541) + 3); | |||
1110 | SfxBindings* pBindings = pDocShell->GetViewBindings(); | |||
1111 | if (pBindings) | |||
1112 | { | |||
1113 | pBindings->Invalidate( nId ); | |||
1114 | pBindings->Invalidate( SID_STYLE_APPLY(5000 + 552) ); | |||
1115 | } | |||
1116 | } | |||
1117 | ||||
1118 | uno::Reference<container::XIndexReplace> ScStyleObj::CreateEmptyNumberingRules() | |||
1119 | { | |||
1120 | SvxNumRule aRule( SvxNumRuleFlags::NONE, 0, true ); // nothing supported | |||
1121 | return SvxCreateNumRule( &aRule ); | |||
1122 | } | |||
1123 | ||||
1124 | // beans::XPropertyState | |||
1125 | ||||
1126 | const SfxItemSet* ScStyleObj::GetStyleItemSet_Impl( const OUString& rPropName, | |||
1127 | const SfxItemPropertySimpleEntry*& rpResultEntry ) | |||
1128 | { | |||
1129 | SfxStyleSheetBase* pStyle = GetStyle_Impl( true ); | |||
1130 | if ( pStyle ) | |||
1131 | { | |||
1132 | const SfxItemPropertySimpleEntry* pEntry = nullptr; | |||
1133 | if ( eFamily == SfxStyleFamily::Page ) | |||
1134 | { | |||
1135 | pEntry = lcl_GetHeaderStyleMap()->getByName( rPropName ); | |||
1136 | if ( pEntry ) // only item-WIDs in header/footer map | |||
1137 | { | |||
1138 | rpResultEntry = pEntry; | |||
1139 | return &pStyle->GetItemSet().Get(ATTR_PAGE_HEADERSET).GetItemSet(); | |||
1140 | } | |||
1141 | pEntry = lcl_GetFooterStyleMap()->getByName( rPropName ); | |||
1142 | if ( pEntry ) // only item-WIDs in header/footer map | |||
1143 | { | |||
1144 | rpResultEntry = pEntry; | |||
1145 | return &pStyle->GetItemSet().Get(ATTR_PAGE_FOOTERSET).GetItemSet(); | |||
1146 | } | |||
1147 | } | |||
1148 | pEntry = pPropSet->getPropertyMap().getByName( rPropName ); | |||
1149 | if ( pEntry ) | |||
1150 | { | |||
1151 | rpResultEntry = pEntry; | |||
1152 | return &pStyle->GetItemSet(); | |||
1153 | } | |||
1154 | } | |||
1155 | ||||
1156 | rpResultEntry = nullptr; | |||
1157 | return nullptr; | |||
1158 | } | |||
1159 | ||||
1160 | beans::PropertyState ScStyleObj::getPropertyState_Impl( const OUString& aPropertyName ) | |||
1161 | { | |||
1162 | beans::PropertyState eRet = beans::PropertyState_DIRECT_VALUE; | |||
1163 | ||||
1164 | const SfxItemPropertySimpleEntry* pResultEntry = nullptr; | |||
1165 | const SfxItemSet* pItemSet = GetStyleItemSet_Impl( aPropertyName, pResultEntry ); | |||
1166 | ||||
1167 | if ( pItemSet && pResultEntry ) | |||
1168 | { | |||
1169 | sal_uInt16 nWhich = pResultEntry->nWID; | |||
1170 | if ( nWhich == SC_WID_UNO_TBLBORD( 1200 + 6 ) || nWhich == SC_WID_UNO_TBLBORD2( 1200 + 43 ) ) | |||
1171 | { | |||
1172 | nWhich = ATTR_BORDER; | |||
1173 | } | |||
1174 | if ( IsScItemWid( nWhich ) ) | |||
1175 | { | |||
1176 | SfxItemState eState = pItemSet->GetItemState( nWhich, false ); | |||
1177 | ||||
1178 | // // if no rotate value is set, look at orientation | |||
1179 | // //! also for a fixed value of 0 (in case orientation is ambiguous)? | |||
1180 | // if ( nWhich == ATTR_ROTATE_VALUE && eState == SfxItemState::DEFAULT ) | |||
1181 | // eState = pItemSet->GetItemState( ATTR_ORIENTATION, sal_False ); | |||
1182 | ||||
1183 | if ( eState == SfxItemState::SET ) | |||
1184 | eRet = beans::PropertyState_DIRECT_VALUE; | |||
1185 | else if ( eState == SfxItemState::DEFAULT ) | |||
1186 | eRet = beans::PropertyState_DEFAULT_VALUE; | |||
1187 | else if ( eState == SfxItemState::DONTCARE ) | |||
1188 | eRet = beans::PropertyState_AMBIGUOUS_VALUE; // should not happen | |||
1189 | else | |||
1190 | { | |||
1191 | OSL_FAIL("unknown ItemState")do { if (true && (((sal_Bool)1))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/sc/source/ui/unoobj/styleuno.cxx" ":" "1191" ": "), "%s", "unknown ItemState"); } } while (false ); | |||
1192 | } | |||
1193 | } | |||
1194 | } | |||
1195 | return eRet; | |||
1196 | } | |||
1197 | ||||
1198 | beans::PropertyState SAL_CALL ScStyleObj::getPropertyState( const OUString& aPropertyName ) | |||
1199 | { | |||
1200 | SolarMutexGuard aGuard; | |||
1201 | GetStyle_Impl(); | |||
1202 | ||||
1203 | return getPropertyState_Impl( aPropertyName ); | |||
1204 | } | |||
1205 | ||||
1206 | uno::Sequence<beans::PropertyState> SAL_CALL ScStyleObj::getPropertyStates( const uno::Sequence<OUString>& aPropertyNames ) | |||
1207 | { | |||
1208 | SolarMutexGuard aGuard; | |||
1209 | GetStyle_Impl(); | |||
1210 | ||||
1211 | uno::Sequence<beans::PropertyState> aRet( aPropertyNames.getLength() ); | |||
1212 | std::transform(aPropertyNames.begin(), aPropertyNames.end(), aRet.begin(), | |||
1213 | [this](const OUString& rName) -> beans::PropertyState { return getPropertyState_Impl(rName); }); | |||
1214 | return aRet; | |||
1215 | } | |||
1216 | ||||
1217 | void SAL_CALL ScStyleObj::setPropertyToDefault( const OUString& aPropertyName ) | |||
1218 | { | |||
1219 | SolarMutexGuard aGuard; | |||
1220 | GetStyle_Impl(); | |||
1221 | ||||
1222 | const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMap().getByName( aPropertyName ); | |||
1223 | if ( !pEntry ) | |||
1224 | throw beans::UnknownPropertyException(aPropertyName); | |||
1225 | ||||
1226 | setPropertyValue_Impl( aPropertyName, pEntry, nullptr ); | |||
1227 | } | |||
1228 | ||||
1229 | uno::Any ScStyleObj::getPropertyDefault_Impl( const OUString& aPropertyName ) | |||
1230 | { | |||
1231 | uno::Any aAny; | |||
1232 | ||||
1233 | const SfxItemPropertySimpleEntry* pResultEntry = nullptr; | |||
1234 | const SfxItemSet* pStyleSet = GetStyleItemSet_Impl( aPropertyName, pResultEntry ); | |||
1235 | ||||
1236 | if ( pStyleSet && pResultEntry ) | |||
1237 | { | |||
1238 | sal_uInt16 nWhich = pResultEntry->nWID; | |||
1239 | ||||
1240 | if ( IsScItemWid( nWhich ) ) | |||
1241 | { | |||
1242 | // Default is default from ItemPool, not from Standard-Style, | |||
1243 | // so it is the same as in setPropertyToDefault | |||
1244 | SfxItemSet aEmptySet( *pStyleSet->GetPool(), pStyleSet->GetRanges() ); | |||
1245 | // default items with wrong Slot-ID are not functional in SfxItemPropertySet3 | |||
1246 | //! change Slot-IDs... | |||
1247 | if ( aEmptySet.GetPool()->GetSlotId(nWhich) == nWhich && | |||
1248 | aEmptySet.GetItemState(nWhich, false) == SfxItemState::DEFAULT ) | |||
1249 | { | |||
1250 | aEmptySet.Put( aEmptySet.Get( nWhich ) ); | |||
1251 | } | |||
1252 | const SfxItemSet* pItemSet = &aEmptySet; | |||
1253 | ||||
1254 | switch ( nWhich ) // special item handling | |||
1255 | { | |||
1256 | case ATTR_VALUE_FORMAT: | |||
1257 | // default has no language set | |||
1258 | aAny <<= sal_Int32( static_cast<const SfxUInt32Item&>(pItemSet->Get(nWhich)).GetValue() ); | |||
1259 | break; | |||
1260 | case ATTR_INDENT: | |||
1261 | aAny <<= sal_Int16( TwipsToHMM(static_cast<const ScIndentItem&>( | |||
1262 | pItemSet->Get(nWhich)).GetValue()) ); | |||
1263 | break; | |||
1264 | case ATTR_PAGE_SCALE: | |||
1265 | case ATTR_PAGE_SCALETOPAGES: | |||
1266 | case ATTR_PAGE_FIRSTPAGENO: | |||
1267 | aAny <<= sal_Int16( static_cast<const SfxUInt16Item&>(pItemSet->Get(nWhich)).GetValue() ); | |||
1268 | break; | |||
1269 | case ATTR_PAGE_CHARTS: | |||
1270 | case ATTR_PAGE_OBJECTS: | |||
1271 | case ATTR_PAGE_DRAWINGS: | |||
1272 | //! define sal_Bool-MID for ScViewObjectModeItem? | |||
1273 | aAny <<= static_cast<const ScViewObjectModeItem&>(pItemSet->Get(nWhich)).GetValue() == VOBJ_MODE_SHOW; | |||
1274 | break; | |||
1275 | case ATTR_PAGE_SCALETO: | |||
1276 | { | |||
1277 | const ScPageScaleToItem aItem(static_cast<const ScPageScaleToItem&>(pItemSet->Get(nWhich))); | |||
1278 | if ( aPropertyName == SC_UNO_PAGE_SCALETOX"ScaleToPagesX" ) | |||
1279 | aAny <<= static_cast<sal_Int16>(aItem.GetWidth()); | |||
1280 | else | |||
1281 | aAny <<= static_cast<sal_Int16>(aItem.GetHeight()); | |||
1282 | } | |||
1283 | break; | |||
1284 | default: | |||
1285 | pPropSet->getPropertyValue( *pResultEntry, *pItemSet, aAny ); | |||
1286 | } | |||
1287 | } | |||
1288 | else if ( IsScUnoWid( nWhich ) ) | |||
1289 | { | |||
1290 | SfxItemSet aEmptySet( *pStyleSet->GetPool(), pStyleSet->GetRanges() ); | |||
1291 | const SfxItemSet* pItemSet = &aEmptySet; | |||
1292 | switch ( nWhich ) | |||
1293 | { | |||
1294 | case SC_WID_UNO_TBLBORD( 1200 + 6 ): | |||
1295 | case SC_WID_UNO_TBLBORD2( 1200 + 43 ): | |||
1296 | { | |||
1297 | const SfxPoolItem& rItem = pItemSet->Get(ATTR_BORDER); | |||
1298 | SvxBoxItem aOuter(static_cast<const SvxBoxItem&>(rItem)); | |||
1299 | SvxBoxInfoItem aInner(ATTR_BORDER_INNER); | |||
1300 | if (nWhich == SC_WID_UNO_TBLBORD2( 1200 + 43 )) | |||
1301 | ScHelperFunctions::AssignTableBorder2ToAny(aAny, aOuter, aInner, true); | |||
1302 | else | |||
1303 | ScHelperFunctions::AssignTableBorderToAny(aAny, aOuter, aInner, true); | |||
1304 | } | |||
1305 | break; | |||
1306 | } | |||
1307 | } | |||
1308 | } | |||
1309 | return aAny; | |||
1310 | } | |||
1311 | ||||
1312 | uno::Any SAL_CALL ScStyleObj::getPropertyDefault( const OUString& aPropertyName ) | |||
1313 | { | |||
1314 | SolarMutexGuard aGuard; | |||
1315 | GetStyle_Impl(); | |||
1316 | ||||
1317 | return getPropertyDefault_Impl( aPropertyName ); | |||
1318 | } | |||
1319 | ||||
1320 | uno::Sequence<uno::Any> SAL_CALL ScStyleObj::getPropertyDefaults( const uno::Sequence<OUString>& aPropertyNames ) | |||
1321 | { | |||
1322 | SolarMutexGuard aGuard; | |||
1323 | GetStyle_Impl(); | |||
1324 | ||||
1325 | uno::Sequence<uno::Any> aSequence( aPropertyNames.getLength() ); | |||
1326 | std::transform(aPropertyNames.begin(), aPropertyNames.end(), aSequence.begin(), | |||
1327 | [this](const OUString& rName) -> uno::Any { return getPropertyDefault_Impl(rName); }); | |||
1328 | return aSequence; | |||
1329 | } | |||
1330 | ||||
1331 | // XMultiPropertySet | |||
1332 | ||||
1333 | void SAL_CALL ScStyleObj::setPropertyValues( const uno::Sequence< OUString >& aPropertyNames, | |||
1334 | const uno::Sequence< uno::Any >& aValues ) | |||
1335 | { | |||
1336 | SolarMutexGuard aGuard; | |||
1337 | GetStyle_Impl(); | |||
1338 | ||||
1339 | if ( aValues.getLength() != aPropertyNames.getLength() ) | |||
1340 | throw lang::IllegalArgumentException(); | |||
1341 | ||||
1342 | const OUString* pNames = aPropertyNames.getConstArray(); | |||
1343 | const uno::Any* pValues = aValues.getConstArray(); | |||
1344 | const SfxItemPropertyMap& rPropertyMap = pPropSet->getPropertyMap(); | |||
1345 | for ( sal_Int32 i = 0; i < aPropertyNames.getLength(); i++ ) | |||
1346 | { | |||
1347 | const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( pNames[i] ); | |||
1348 | setPropertyValue_Impl( pNames[i], pEntry, &pValues[i] ); | |||
1349 | } | |||
1350 | } | |||
1351 | ||||
1352 | uno::Sequence<uno::Any> SAL_CALL ScStyleObj::getPropertyValues( const uno::Sequence< OUString >& aPropertyNames ) | |||
1353 | { | |||
1354 | SolarMutexGuard aGuard; | |||
1355 | GetStyle_Impl(); | |||
1356 | ||||
1357 | uno::Sequence<uno::Any> aSequence( aPropertyNames.getLength() ); | |||
1358 | std::transform(aPropertyNames.begin(), aPropertyNames.end(), aSequence.begin(), | |||
1359 | [this](const OUString& rName) -> uno::Any { return getPropertyValue_Impl(rName); }); | |||
1360 | return aSequence; | |||
1361 | } | |||
1362 | ||||
1363 | void SAL_CALL ScStyleObj::addPropertiesChangeListener( const uno::Sequence<OUString>& /* aPropertyNames */, | |||
1364 | const uno::Reference<beans::XPropertiesChangeListener>& /* xListener */ ) | |||
1365 | { | |||
1366 | // no bound properties | |||
1367 | } | |||
1368 | ||||
1369 | void SAL_CALL ScStyleObj::removePropertiesChangeListener( | |||
1370 | const uno::Reference<beans::XPropertiesChangeListener>& /* xListener */ ) | |||
1371 | { | |||
1372 | // no bound properties | |||
1373 | } | |||
1374 | ||||
1375 | void SAL_CALL ScStyleObj::firePropertiesChangeEvent( const uno::Sequence<OUString>& /* aPropertyNames */, | |||
1376 | const uno::Reference<beans::XPropertiesChangeListener>& /* xListener */ ) | |||
1377 | { | |||
1378 | // no bound properties | |||
1379 | } | |||
1380 | ||||
1381 | // XMultiPropertyStates | |||
1382 | // getPropertyStates already defined for XPropertyState | |||
1383 | ||||
1384 | void SAL_CALL ScStyleObj::setAllPropertiesToDefault() | |||
1385 | { | |||
1386 | SolarMutexGuard aGuard; | |||
1387 | ||||
1388 | SfxStyleSheetBase* pStyle = GetStyle_Impl(); | |||
1389 | if ( !pStyle ) | |||
1390 | return; | |||
1391 | ||||
1392 | // cell styles cannot be modified if any sheet is protected | |||
1393 | if ( eFamily == SfxStyleFamily::Para && lcl_AnyTabProtected( pDocShell->GetDocument() ) ) | |||
1394 | throw uno::RuntimeException(); | |||
1395 | ||||
1396 | SfxItemSet& rSet = pStyle->GetItemSet(); | |||
1397 | rSet.ClearItem(); // set all items to default | |||
1398 | ||||
1399 | //! merge with SetOneProperty | |||
1400 | ||||
1401 | ScDocument& rDoc = pDocShell->GetDocument(); | |||
1402 | if ( eFamily == SfxStyleFamily::Para ) | |||
1403 | { | |||
1404 | // row heights | |||
1405 | ||||
1406 | ScopedVclPtrInstance< VirtualDevice > pVDev; | |||
1407 | Point aLogic = pVDev->LogicToPixel(Point(1000,1000), MapMode(MapUnit::MapTwip)); | |||
1408 | double nPPTX = aLogic.X() / 1000.0; | |||
1409 | double nPPTY = aLogic.Y() / 1000.0; | |||
1410 | Fraction aZoom(1,1); | |||
1411 | rDoc.StyleSheetChanged( pStyle, false, pVDev, nPPTX, nPPTY, aZoom, aZoom ); | |||
1412 | ||||
1413 | if (!rDoc.IsImportingXML()) | |||
1414 | { | |||
1415 | pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left ); | |||
1416 | pDocShell->SetDocumentModified(); | |||
1417 | } | |||
1418 | } | |||
1419 | else | |||
1420 | { | |||
1421 | // #i22448# apply the default BoxInfoItem for page styles again | |||
1422 | // (same content as in ScStyleSheet::GetItemSet, to control the dialog) | |||
1423 | SvxBoxInfoItem aBoxInfoItem( ATTR_BORDER_INNER ); | |||
1424 | aBoxInfoItem.SetTable( false ); | |||
1425 | aBoxInfoItem.SetDist( true ); | |||
1426 | aBoxInfoItem.SetValid( SvxBoxInfoItemValidFlags::DISTANCE ); | |||
1427 | rSet.Put( aBoxInfoItem ); | |||
1428 | ||||
1429 | pDocShell->PageStyleModified( aStyleName, true ); | |||
1430 | } | |||
1431 | } | |||
1432 | ||||
1433 | void SAL_CALL ScStyleObj::setPropertiesToDefault( const uno::Sequence<OUString>& aPropertyNames ) | |||
1434 | { | |||
1435 | SolarMutexGuard aGuard; | |||
1436 | GetStyle_Impl(); | |||
1437 | ||||
1438 | const SfxItemPropertyMap& rPropertyMap = pPropSet->getPropertyMap(); | |||
1439 | for ( const OUString& rName : aPropertyNames ) | |||
1440 | { | |||
1441 | const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( rName ); | |||
1442 | setPropertyValue_Impl( rName, pEntry, nullptr ); | |||
1443 | } | |||
1444 | } | |||
1445 | ||||
1446 | // beans::XPropertySet | |||
1447 | ||||
1448 | uno::Reference<beans::XPropertySetInfo> SAL_CALL ScStyleObj::getPropertySetInfo() | |||
1449 | { | |||
1450 | SolarMutexGuard aGuard; | |||
1451 | return pPropSet->getPropertySetInfo(); | |||
1452 | } | |||
1453 | ||||
1454 | void SAL_CALL ScStyleObj::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue ) | |||
1455 | { | |||
1456 | SolarMutexGuard aGuard; | |||
1457 | GetStyle_Impl(); | |||
1458 | ||||
1459 | const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMap().getByName( aPropertyName ); | |||
1460 | if ( !pEntry ) | |||
1461 | throw beans::UnknownPropertyException(aPropertyName); | |||
1462 | ||||
1463 | setPropertyValue_Impl( aPropertyName, pEntry, &aValue ); | |||
1464 | } | |||
1465 | ||||
1466 | void ScStyleObj::setPropertyValue_Impl( const OUString& rPropertyName, const SfxItemPropertySimpleEntry* pEntry, const uno::Any* pValue ) | |||
1467 | { | |||
1468 | SfxStyleSheetBase* pStyle = GetStyle_Impl( true ); | |||
1469 | if ( !(pStyle && pEntry) ) | |||
1470 | return; | |||
1471 | ||||
1472 | // cell styles cannot be modified if any sheet is protected | |||
1473 | if ( eFamily == SfxStyleFamily::Para && lcl_AnyTabProtected( pDocShell->GetDocument() ) ) | |||
1474 | throw uno::RuntimeException(); | |||
1475 | ||||
1476 | SfxItemSet& rSet = pStyle->GetItemSet(); // change directly in active Style | |||
1477 | bool bDone = false; | |||
1478 | if ( eFamily == SfxStyleFamily::Page ) | |||
1479 | { | |||
1480 | if(pEntry->nWID == SC_WID_UNO_HEADERSET( 1200 + 26 )) | |||
1481 | { | |||
1482 | const SfxItemPropertySimpleEntry* pHeaderEntry = lcl_GetHeaderStyleMap()->getByName( rPropertyName ); | |||
1483 | if ( pHeaderEntry ) // only item-WIDs in header/footer map | |||
1484 | { | |||
1485 | SvxSetItem aNewHeader( rSet.Get(ATTR_PAGE_HEADERSET) ); | |||
1486 | if (pValue) | |||
1487 | pPropSet->setPropertyValue( *pHeaderEntry, *pValue, aNewHeader.GetItemSet() ); | |||
1488 | else | |||
1489 | aNewHeader.GetItemSet().ClearItem( pHeaderEntry->nWID ); | |||
1490 | rSet.Put( aNewHeader ); | |||
1491 | bDone = true; | |||
1492 | } | |||
1493 | } | |||
1494 | else if(pEntry->nWID == SC_WID_UNO_FOOTERSET( 1200 + 27 )) | |||
1495 | { | |||
1496 | const SfxItemPropertySimpleEntry* pFooterEntry = lcl_GetFooterStyleMap()->getByName( rPropertyName ); | |||
1497 | if ( pFooterEntry ) // only item-WIDs in header/footer map | |||
1498 | { | |||
1499 | SvxSetItem aNewFooter( rSet.Get(ATTR_PAGE_FOOTERSET) ); | |||
1500 | if (pValue) | |||
1501 | pPropSet->setPropertyValue( *pFooterEntry, *pValue, aNewFooter.GetItemSet() ); | |||
1502 | else | |||
1503 | aNewFooter.GetItemSet().ClearItem( pFooterEntry->nWID ); | |||
1504 | rSet.Put( aNewFooter ); | |||
1505 | bDone = true; | |||
1506 | } | |||
1507 | } | |||
1508 | } | |||
1509 | if (!bDone) | |||
1510 | { | |||
1511 | if (IsScItemWid(pEntry->nWID)) | |||
1512 | { | |||
1513 | if (pValue) | |||
1514 | { | |||
1515 | switch (pEntry->nWID) // special item handling | |||
1516 | { | |||
1517 | case ATTR_VALUE_FORMAT: | |||
1518 | { | |||
1519 | // language for number formats | |||
1520 | SvNumberFormatter* pFormatter | |||
1521 | = pDocShell->GetDocument().GetFormatTable(); | |||
1522 | sal_uInt32 nOldFormat = rSet.Get(ATTR_VALUE_FORMAT).GetValue(); | |||
1523 | LanguageType eOldLang | |||
1524 | = rSet.Get(ATTR_LANGUAGE_FORMAT).GetLanguage(); | |||
1525 | pFormatter->GetFormatForLanguageIfBuiltIn(nOldFormat, eOldLang); | |||
1526 | ||||
1527 | sal_uInt32 nNewFormat = 0; | |||
1528 | *pValue >>= nNewFormat; | |||
1529 | rSet.Put(SfxUInt32Item(ATTR_VALUE_FORMAT, nNewFormat)); | |||
1530 | ||||
1531 | const SvNumberformat* pNewEntry = pFormatter->GetEntry(nNewFormat); | |||
1532 | LanguageType eNewLang | |||
1533 | = pNewEntry ? pNewEntry->GetLanguage() : LANGUAGE_DONTKNOWLanguageType(0x03FF); | |||
1534 | if (eNewLang != eOldLang && eNewLang != LANGUAGE_DONTKNOWLanguageType(0x03FF)) | |||
1535 | rSet.Put(SvxLanguageItem(eNewLang, ATTR_LANGUAGE_FORMAT)); | |||
1536 | ||||
1537 | //! keep default state of number format if only language changed? | |||
1538 | } | |||
1539 | break; | |||
1540 | case ATTR_INDENT: | |||
1541 | { | |||
1542 | sal_Int16 nVal = 0; | |||
1543 | *pValue >>= nVal; | |||
1544 | rSet.Put(ScIndentItem(static_cast<sal_uInt16>(HMMToTwips(nVal)))); | |||
1545 | } | |||
1546 | break; | |||
1547 | case ATTR_ROTATE_VALUE: | |||
1548 | { | |||
1549 | sal_Int32 nRotVal = 0; | |||
1550 | if (*pValue >>= nRotVal) | |||
1551 | { | |||
1552 | // stored value is always between 0 and 360 deg. | |||
1553 | nRotVal %= 36000; | |||
1554 | if (nRotVal < 0) | |||
1555 | nRotVal += 36000; | |||
1556 | rSet.Put(ScRotateValueItem(nRotVal)); | |||
1557 | } | |||
1558 | } | |||
1559 | break; | |||
1560 | case ATTR_STACKED: | |||
1561 | { | |||
1562 | table::CellOrientation eOrient; | |||
1563 | if (*pValue >>= eOrient) | |||
1564 | { | |||
1565 | switch (eOrient) | |||
1566 | { | |||
1567 | case table::CellOrientation_STANDARD: | |||
1568 | rSet.Put(ScVerticalStackCell(false)); | |||
1569 | break; | |||
1570 | case table::CellOrientation_TOPBOTTOM: | |||
1571 | rSet.Put(ScVerticalStackCell(false)); | |||
1572 | rSet.Put(ScRotateValueItem(27000)); | |||
1573 | break; | |||
1574 | case table::CellOrientation_BOTTOMTOP: | |||
1575 | rSet.Put(ScVerticalStackCell(false)); | |||
1576 | rSet.Put(ScRotateValueItem(9000)); | |||
1577 | break; | |||
1578 | case table::CellOrientation_STACKED: | |||
1579 | rSet.Put(ScVerticalStackCell(true)); | |||
1580 | break; | |||
1581 | default: | |||
1582 | { | |||
1583 | // added to avoid warnings | |||
1584 | } | |||
1585 | } | |||
1586 | } | |||
1587 | } | |||
1588 | break; | |||
1589 | case ATTR_PAGE_SCALE: | |||
1590 | case ATTR_PAGE_SCALETOPAGES: | |||
1591 | { | |||
1592 | rSet.ClearItem(ATTR_PAGE_SCALETOPAGES); | |||
1593 | rSet.ClearItem(ATTR_PAGE_SCALE); | |||
1594 | rSet.ClearItem(ATTR_PAGE_SCALETO); | |||
1595 | sal_Int16 nVal = 0; | |||
1596 | *pValue >>= nVal; | |||
1597 | rSet.Put(SfxUInt16Item(pEntry->nWID, nVal)); | |||
1598 | } | |||
1599 | break; | |||
1600 | case ATTR_PAGE_FIRSTPAGENO: | |||
1601 | { | |||
1602 | sal_Int16 nVal = 0; | |||
1603 | *pValue >>= nVal; | |||
1604 | rSet.Put(SfxUInt16Item(ATTR_PAGE_FIRSTPAGENO, nVal)); | |||
1605 | } | |||
1606 | break; | |||
1607 | case ATTR_PAGE_CHARTS: | |||
1608 | case ATTR_PAGE_OBJECTS: | |||
1609 | case ATTR_PAGE_DRAWINGS: | |||
1610 | { | |||
1611 | bool bBool = false; | |||
1612 | *pValue >>= bBool; | |||
1613 | //! need to define sal_Bool-MID for ScViewObjectModeItem? | |||
1614 | rSet.Put(ScViewObjectModeItem( | |||
1615 | pEntry->nWID, bBool ? VOBJ_MODE_SHOW : VOBJ_MODE_HIDE)); | |||
1616 | } | |||
1617 | break; | |||
1618 | case ATTR_PAGE_PAPERBIN: | |||
1619 | { | |||
1620 | sal_uInt8 nTray = PAPERBIN_PRINTER_SETTINGS(sal_uInt8(0xFF)); | |||
1621 | bool bFound = false; | |||
1622 | ||||
1623 | OUString aName; | |||
1624 | if (*pValue >>= aName) | |||
1625 | { | |||
1626 | if (aName == SC_PAPERBIN_DEFAULTNAME"[From printer settings]") | |||
1627 | bFound = true; | |||
1628 | else | |||
1629 | { | |||
1630 | Printer* pPrinter = pDocShell->GetPrinter(); | |||
1631 | if (pPrinter) | |||
1632 | { | |||
1633 | const sal_uInt16 nCount = pPrinter->GetPaperBinCount(); | |||
1634 | for (sal_uInt16 i = 0; i < nCount; i++) | |||
1635 | if (aName == pPrinter->GetPaperBinName(i)) | |||
1636 | { | |||
1637 | nTray = static_cast<sal_uInt8>(i); | |||
1638 | bFound = true; | |||
1639 | break; | |||
1640 | } | |||
1641 | } | |||
1642 | } | |||
1643 | } | |||
1644 | if (!bFound) | |||
1645 | throw lang::IllegalArgumentException(); | |||
1646 | ||||
1647 | rSet.Put(SvxPaperBinItem(ATTR_PAGE_PAPERBIN, nTray)); | |||
1648 | ||||
1649 | } | |||
1650 | break; | |||
1651 | case ATTR_PAGE_SCALETO: | |||
1652 | { | |||
1653 | sal_Int16 nPages = 0; | |||
1654 | if (*pValue >>= nPages) | |||
1655 | { | |||
1656 | ScPageScaleToItem aItem = rSet.Get(ATTR_PAGE_SCALETO); | |||
1657 | if (rPropertyName == SC_UNO_PAGE_SCALETOX"ScaleToPagesX") | |||
1658 | aItem.SetWidth(static_cast<sal_uInt16>(nPages)); | |||
1659 | else | |||
1660 | aItem.SetHeight(static_cast<sal_uInt16>(nPages)); | |||
1661 | rSet.Put(aItem); | |||
1662 | rSet.ClearItem(ATTR_PAGE_SCALETOPAGES); | |||
1663 | rSet.ClearItem(ATTR_PAGE_SCALE); | |||
1664 | } | |||
1665 | } | |||
1666 | break; | |||
1667 | case ATTR_HIDDEN: | |||
1668 | { | |||
1669 | bool bHidden = false; | |||
1670 | if (*pValue >>= bHidden) | |||
1671 | pStyle->SetHidden(bHidden); | |||
1672 | } | |||
1673 | break; | |||
1674 | default: | |||
1675 | // default items with wrong Slot-ID are not working in SfxItemPropertySet3 | |||
1676 | //! change Slot-IDs... | |||
1677 | if (rSet.GetPool()->GetSlotId(pEntry->nWID) == pEntry->nWID | |||
1678 | && rSet.GetItemState(pEntry->nWID, false) == SfxItemState::DEFAULT) | |||
1679 | { | |||
1680 | rSet.Put(rSet.Get(pEntry->nWID)); | |||
1681 | } | |||
1682 | pPropSet->setPropertyValue(*pEntry, *pValue, rSet); | |||
1683 | } | |||
1684 | } | |||
1685 | else | |||
1686 | { | |||
1687 | rSet.ClearItem(pEntry->nWID); | |||
1688 | // language for number formats | |||
1689 | if (pEntry->nWID == ATTR_VALUE_FORMAT) | |||
1690 | rSet.ClearItem(ATTR_LANGUAGE_FORMAT); | |||
1691 | ||||
1692 | //! for ATTR_ROTATE_VALUE, also reset ATTR_ORIENTATION? | |||
1693 | } | |||
1694 | } | |||
1695 | else if (IsScUnoWid(pEntry->nWID)) | |||
1696 | { | |||
1697 | switch (pEntry->nWID) | |||
1698 | { | |||
1699 | case SC_WID_UNO_TBLBORD( 1200 + 6 ): | |||
1700 | { | |||
1701 | if (pValue) | |||
1702 | { | |||
1703 | table::TableBorder aBorder; | |||
1704 | if (*pValue >>= aBorder) | |||
1705 | { | |||
1706 | SvxBoxItem aOuter(ATTR_BORDER); | |||
1707 | SvxBoxInfoItem aInner(ATTR_BORDER_INNER); | |||
1708 | ScHelperFunctions::FillBoxItems(aOuter, aInner, aBorder); | |||
1709 | rSet.Put(aOuter); | |||
1710 | } | |||
1711 | } | |||
1712 | else | |||
1713 | { | |||
1714 | rSet.ClearItem(ATTR_BORDER); | |||
1715 | } | |||
1716 | } | |||
1717 | break; | |||
1718 | case SC_WID_UNO_TBLBORD2( 1200 + 43 ): | |||
1719 | { | |||
1720 | if (pValue) | |||
1721 | { | |||
1722 | table::TableBorder2 aBorder2; | |||
1723 | if (*pValue >>= aBorder2) | |||
1724 | { | |||
1725 | SvxBoxItem aOuter(ATTR_BORDER); | |||
1726 | SvxBoxInfoItem aInner(ATTR_BORDER_INNER); | |||
1727 | ScHelperFunctions::FillBoxItems(aOuter, aInner, aBorder2); | |||
1728 | rSet.Put(aOuter); | |||
1729 | } | |||
1730 | } | |||
1731 | else | |||
1732 | { | |||
1733 | rSet.ClearItem(ATTR_BORDER); | |||
1734 | } | |||
1735 | } | |||
1736 | break; | |||
1737 | } | |||
1738 | } | |||
1739 | } | |||
1740 | ||||
1741 | //! DocFunc-?? | |||
1742 | //! Undo ?? | |||
1743 | ||||
1744 | ScDocument& rDoc = pDocShell->GetDocument(); | |||
1745 | if ( eFamily == SfxStyleFamily::Para ) | |||
1746 | { | |||
1747 | // If we are loading, we can delay line height calculation, because we are going to re-calc all of those | |||
1748 | // after load. | |||
1749 | if (pDocShell && !pDocShell->IsLoading()) | |||
1750 | { | |||
1751 | // update line height | |||
1752 | ScopedVclPtrInstance< VirtualDevice > pVDev; | |||
1753 | Point aLogic = pVDev->LogicToPixel(Point(1000,1000), MapMode(MapUnit::MapTwip)); | |||
1754 | double nPPTX = aLogic.X() / 1000.0; | |||
1755 | double nPPTY = aLogic.Y() / 1000.0; | |||
1756 | Fraction aZoom(1,1); | |||
1757 | rDoc.StyleSheetChanged( pStyle, false, pVDev, nPPTX, nPPTY, aZoom, aZoom ); | |||
1758 | ||||
1759 | if (!rDoc.IsImportingXML()) | |||
1760 | { | |||
1761 | pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left ); | |||
1762 | pDocShell->SetDocumentModified(); | |||
1763 | } | |||
1764 | } | |||
1765 | } | |||
1766 | else | |||
1767 | { | |||
1768 | //! ModifyStyleSheet on document (save old values) | |||
1769 | ||||
1770 | pDocShell->PageStyleModified( aStyleName, true ); | |||
1771 | } | |||
1772 | } | |||
1773 | ||||
1774 | uno::Any ScStyleObj::getPropertyValue_Impl( const OUString& aPropertyName ) | |||
1775 | { | |||
1776 | uno::Any aAny; | |||
1777 | SfxStyleSheetBase* pStyle = GetStyle_Impl( true ); | |||
1778 | ||||
1779 | if ( aPropertyName == SC_UNONAME_DISPNAME"DisplayName" ) // read-only | |||
1780 | { | |||
1781 | // core always has the display name | |||
1782 | if ( pStyle ) | |||
1783 | aAny <<= pStyle->GetName(); | |||
1784 | } | |||
1785 | else | |||
1786 | { | |||
1787 | const SfxItemPropertySimpleEntry* pResultEntry = nullptr; | |||
1788 | const SfxItemSet* pItemSet = GetStyleItemSet_Impl( aPropertyName, pResultEntry ); | |||
1789 | ||||
1790 | if ( pItemSet && pResultEntry ) | |||
1791 | { | |||
1792 | sal_uInt16 nWhich = pResultEntry->nWID; | |||
1793 | ||||
1794 | if ( IsScItemWid( nWhich ) ) | |||
1795 | { | |||
1796 | switch ( nWhich ) // for special item handling | |||
1797 | { | |||
1798 | case ATTR_VALUE_FORMAT: | |||
1799 | if ( pDocShell ) | |||
1800 | { | |||
1801 | sal_uInt32 nOldFormat = | |||
1802 | pItemSet->Get( ATTR_VALUE_FORMAT ).GetValue(); | |||
1803 | LanguageType eOldLang = | |||
1804 | pItemSet->Get( ATTR_LANGUAGE_FORMAT ).GetLanguage(); | |||
1805 | nOldFormat = pDocShell->GetDocument().GetFormatTable()-> | |||
1806 | GetFormatForLanguageIfBuiltIn( nOldFormat, eOldLang ); | |||
1807 | aAny <<= nOldFormat; | |||
1808 | } | |||
1809 | break; | |||
1810 | case ATTR_INDENT: | |||
1811 | aAny <<= sal_Int16( TwipsToHMM(static_cast<const ScIndentItem&>( | |||
1812 | pItemSet->Get(nWhich)).GetValue()) ); | |||
1813 | break; | |||
1814 | case ATTR_STACKED: | |||
1815 | { | |||
1816 | sal_Int32 nRot = pItemSet->Get(ATTR_ROTATE_VALUE).GetValue(); | |||
1817 | bool bStacked = static_cast<const ScVerticalStackCell&>(pItemSet->Get(nWhich)).GetValue(); | |||
1818 | SvxOrientationItem( nRot, bStacked, 0 ).QueryValue( aAny ); | |||
1819 | } | |||
1820 | break; | |||
1821 | case ATTR_PAGE_SCALE: | |||
1822 | case ATTR_PAGE_SCALETOPAGES: | |||
1823 | case ATTR_PAGE_FIRSTPAGENO: | |||
1824 | aAny <<= sal_Int16( static_cast<const SfxUInt16Item&>(pItemSet->Get(nWhich)).GetValue() ); | |||
1825 | break; | |||
1826 | case ATTR_PAGE_CHARTS: | |||
1827 | case ATTR_PAGE_OBJECTS: | |||
1828 | case ATTR_PAGE_DRAWINGS: | |||
1829 | //! define sal_Bool-MID for ScViewObjectModeItem? | |||
1830 | aAny <<= static_cast<const ScViewObjectModeItem&>(pItemSet->Get(nWhich)).GetValue() == VOBJ_MODE_SHOW; | |||
1831 | break; | |||
1832 | case ATTR_PAGE_PAPERBIN: | |||
1833 | { | |||
1834 | // property PrinterPaperTray is the name of the tray | |||
1835 | ||||
1836 | sal_uInt8 nValue = static_cast<const SvxPaperBinItem&>(pItemSet->Get(nWhich)).GetValue(); | |||
1837 | OUString aName; | |||
1838 | if ( nValue == PAPERBIN_PRINTER_SETTINGS(sal_uInt8(0xFF)) ) | |||
1839 | aName = SC_PAPERBIN_DEFAULTNAME"[From printer settings]"; | |||
1840 | else | |||
1841 | { | |||
1842 | Printer* pPrinter = pDocShell->GetPrinter(); | |||
1843 | if (pPrinter) | |||
1844 | aName = pPrinter->GetPaperBinName( nValue ); | |||
1845 | } | |||
1846 | aAny <<= aName; | |||
1847 | } | |||
1848 | break; | |||
1849 | case ATTR_PAGE_SCALETO: | |||
1850 | { | |||
1851 | const ScPageScaleToItem& aItem(pItemSet->Get(ATTR_PAGE_SCALETO)); | |||
1852 | if ( aPropertyName == SC_UNO_PAGE_SCALETOX"ScaleToPagesX" ) | |||
1853 | aAny <<= static_cast<sal_Int16>(aItem.GetWidth()); | |||
1854 | else | |||
1855 | aAny <<= static_cast<sal_Int16>(aItem.GetHeight()); | |||
1856 | } | |||
1857 | break; | |||
1858 | case ATTR_HIDDEN: | |||
1859 | { | |||
1860 | bool bHidden = pStyle && pStyle->IsHidden(); | |||
1861 | aAny <<= bHidden; | |||
1862 | } | |||
1863 | break; | |||
1864 | default: | |||
1865 | // Default-Items with wrong Slot-ID don't work in SfxItemPropertySet3 | |||
1866 | //! change Slot-IDs... | |||
1867 | if ( pItemSet->GetPool()->GetSlotId(nWhich) == nWhich && | |||
1868 | pItemSet->GetItemState(nWhich, false) == SfxItemState::DEFAULT ) | |||
1869 | { | |||
1870 | SfxItemSet aNoEmptySet( *pItemSet ); | |||
1871 | aNoEmptySet.Put( aNoEmptySet.Get( nWhich ) ); | |||
1872 | pPropSet->getPropertyValue( *pResultEntry, aNoEmptySet, aAny ); | |||
1873 | } | |||
1874 | else | |||
1875 | pPropSet->getPropertyValue( *pResultEntry, *pItemSet, aAny ); | |||
1876 | } | |||
1877 | } | |||
1878 | else if ( IsScUnoWid( nWhich ) ) | |||
1879 | { | |||
1880 | switch ( nWhich ) | |||
1881 | { | |||
1882 | case SC_WID_UNO_TBLBORD( 1200 + 6 ): | |||
1883 | case SC_WID_UNO_TBLBORD2( 1200 + 43 ): | |||
1884 | { | |||
1885 | const SfxPoolItem& rItem = pItemSet->Get(ATTR_BORDER); | |||
1886 | SvxBoxItem aOuter(static_cast<const SvxBoxItem&>(rItem)); | |||
1887 | SvxBoxInfoItem aInner(ATTR_BORDER_INNER); | |||
1888 | if (nWhich == SC_WID_UNO_TBLBORD2( 1200 + 43 )) | |||
1889 | ScHelperFunctions::AssignTableBorder2ToAny(aAny, aOuter, aInner, | |||
1890 | true); | |||
1891 | else | |||
1892 | ScHelperFunctions::AssignTableBorderToAny(aAny, aOuter, aInner, | |||
1893 | true); | |||
1894 | } | |||
1895 | break; | |||
1896 | } | |||
1897 | } | |||
1898 | } | |||
1899 | } | |||
1900 | ||||
1901 | return aAny; | |||
1902 | } | |||
1903 | ||||
1904 | uno::Any SAL_CALL ScStyleObj::getPropertyValue( const OUString& aPropertyName ) | |||
1905 | { | |||
1906 | SolarMutexGuard aGuard; | |||
1907 | GetStyle_Impl(); | |||
1908 | ||||
1909 | return getPropertyValue_Impl( aPropertyName ); | |||
1910 | } | |||
1911 | ||||
1912 | SC_IMPL_DUMMY_PROPERTY_LISTENER( ScStyleObj )void ScStyleObj::addPropertyChangeListener( const OUString& , const uno::Reference<beans::XPropertyChangeListener>& ) { do { if (true && (((sal_Bool)1))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/sc/source/ui/unoobj/styleuno.cxx" ":" "1912" ": "), "%s", "not implemented"); } } while (false ); } void ScStyleObj::removePropertyChangeListener( const OUString &, const uno::Reference<beans::XPropertyChangeListener >&) { do { if (true && (((sal_Bool)1))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/sc/source/ui/unoobj/styleuno.cxx" ":" "1912" ": "), "%s", "not implemented"); } } while (false ); } void ScStyleObj::addVetoableChangeListener( const OUString &, const uno::Reference<beans::XVetoableChangeListener >&) { do { if (true && (((sal_Bool)1))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/sc/source/ui/unoobj/styleuno.cxx" ":" "1912" ": "), "%s", "not implemented"); } } while (false ); } void ScStyleObj::removeVetoableChangeListener( const OUString &, const uno::Reference<beans::XVetoableChangeListener >&) { do { if (true && (((sal_Bool)1))) { sal_detail_logFormat ((SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/sc/source/ui/unoobj/styleuno.cxx" ":" "1912" ": "), "%s", "not implemented"); } } while (false ); } | |||
1913 | ||||
1914 | // lang::XServiceInfo | |||
1915 | ||||
1916 | OUString SAL_CALL ScStyleObj::getImplementationName() | |||
1917 | { | |||
1918 | return "ScStyleObj"; | |||
1919 | } | |||
1920 | ||||
1921 | sal_Bool SAL_CALL ScStyleObj::supportsService( const OUString& rServiceName ) | |||
1922 | { | |||
1923 | return cppu::supportsService(this, rServiceName); | |||
1924 | } | |||
1925 | ||||
1926 | uno::Sequence<OUString> SAL_CALL ScStyleObj::getSupportedServiceNames() | |||
1927 | { | |||
1928 | const bool bPage = ( eFamily == SfxStyleFamily::Page ); | |||
1929 | ||||
1930 | return {SCSTYLE_SERVICE"com.sun.star.style.Style", | |||
1931 | (bPage ? OUString(SCPAGESTYLE_SERVICE"com.sun.star.style.PageStyle") | |||
1932 | : OUString(SCCELLSTYLE_SERVICE"com.sun.star.style.CellStyle"))}; | |||
1933 | } | |||
1934 | ||||
1935 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |
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 | #ifndef INCLUDED_VCL_PTR_HXX |
21 | #define INCLUDED_VCL_PTR_HXX |
22 | |
23 | #include <sal/config.h> |
24 | |
25 | #include <rtl/ref.hxx> |
26 | |
27 | #include <utility> |
28 | #include <type_traits> |
29 | |
30 | #ifdef DBG_UTIL |
31 | #ifndef _WIN32 |
32 | #include <vcl/vclmain.hxx> |
33 | #endif |
34 | #endif |
35 | |
36 | class VclReferenceBase; |
37 | |
38 | namespace vcl::detail { |
39 | |
40 | template<typename> |
41 | constexpr bool isIncompleteOrDerivedFromVclReferenceBase(...) { return true; } |
42 | |
43 | template<typename T> constexpr bool isIncompleteOrDerivedFromVclReferenceBase( |
44 | int (*)[sizeof(T)]) |
45 | { return std::is_base_of<VclReferenceBase, T>::value; } |
46 | |
47 | } // namespace vcl::detail |
48 | |
49 | /** |
50 | * A thin wrapper around rtl::Reference to implement the acquire and dispose semantics we want for references to vcl::Window subclasses. |
51 | * |
52 | * For more details on the design please see vcl/README.lifecycle |
53 | * |
54 | * @param reference_type must be a subclass of vcl::Window |
55 | */ |
56 | template <class reference_type> |
57 | class VclPtr |
58 | { |
59 | static_assert( |
60 | vcl::detail::isIncompleteOrDerivedFromVclReferenceBase<reference_type>( |
61 | nullptr), |
62 | "template argument type must be derived from VclReferenceBase"); |
63 | |
64 | ::rtl::Reference<reference_type> m_rInnerRef; |
65 | |
66 | public: |
67 | /** Constructor... |
68 | */ |
69 | VclPtr() |
70 | : m_rInnerRef() |
71 | {} |
72 | |
73 | /** Constructor... |
74 | */ |
75 | VclPtr (reference_type * pBody) |
76 | : m_rInnerRef(pBody) |
77 | {} |
78 | |
79 | /** Constructor... that doesn't take a ref. |
80 | */ |
81 | VclPtr (reference_type * pBody, __sal_NoAcquire) |
82 | : m_rInnerRef(pBody, SAL_NO_ACQUIRE) |
83 | {} |
84 | |
85 | /** Up-casting conversion constructor: Copies interface reference. |
86 | |
87 | Does not work for up-casts to ambiguous bases. For the special case of |
88 | up-casting to Reference< XInterface >, see the corresponding conversion |
89 | operator. |
90 | |
91 | @param rRef another reference |
92 | */ |
93 | template< class derived_type > |
94 | VclPtr( |
95 | const VclPtr< derived_type > & rRef, |
96 | typename std::enable_if< |
97 | std::is_base_of<reference_type, derived_type>::value, int>::type |
98 | = 0 ) |
99 | : m_rInnerRef( static_cast<reference_type*>(rRef) ) |
100 | { |
101 | } |
102 | |
103 | #if defined(DBG_UTIL) && !defined(_WIN32) |
104 | virtual ~VclPtr() |
105 | { |
106 | assert(m_rInnerRef.get() == nullptr || vclmain::isAlive())(static_cast <bool> (m_rInnerRef.get() == nullptr || vclmain ::isAlive()) ? void (0) : __assert_fail ("m_rInnerRef.get() == nullptr || vclmain::isAlive()" , "/home/maarten/src/libreoffice/core/include/vcl/vclptr.hxx" , 106, __extension__ __PRETTY_FUNCTION__)); |
107 | // We can be one of the intermediate counts, but if we are the last |
108 | // VclPtr keeping this object alive, then something forgot to call dispose(). |
109 | assert((!m_rInnerRef.get() || m_rInnerRef->isDisposed() || m_rInnerRef->getRefCount() > 1)(static_cast <bool> ((!m_rInnerRef.get() || m_rInnerRef ->isDisposed() || m_rInnerRef->getRefCount() > 1) && "someone forgot to call dispose()") ? void (0) : __assert_fail ("(!m_rInnerRef.get() || m_rInnerRef->isDisposed() || m_rInnerRef->getRefCount() > 1) && \"someone forgot to call dispose()\"" , "/home/maarten/src/libreoffice/core/include/vcl/vclptr.hxx" , 110, __extension__ __PRETTY_FUNCTION__)) |
110 | && "someone forgot to call dispose()")(static_cast <bool> ((!m_rInnerRef.get() || m_rInnerRef ->isDisposed() || m_rInnerRef->getRefCount() > 1) && "someone forgot to call dispose()") ? void (0) : __assert_fail ("(!m_rInnerRef.get() || m_rInnerRef->isDisposed() || m_rInnerRef->getRefCount() > 1) && \"someone forgot to call dispose()\"" , "/home/maarten/src/libreoffice/core/include/vcl/vclptr.hxx" , 110, __extension__ __PRETTY_FUNCTION__)); |
111 | } |
112 | VclPtr(VclPtr const &) = default; |
113 | VclPtr(VclPtr &&) = default; |
114 | VclPtr & operator =(VclPtr const &) = default; |
115 | VclPtr & operator =(VclPtr &&) = default; |
116 | #endif |
117 | |
118 | /** |
119 | * A construction helper for VclPtr. Since VclPtr types are created |
120 | * with a reference-count of one - to help fit into the existing |
121 | * code-flow; this helps us to construct them easily. |
122 | * |
123 | * For more details on the design please see vcl/README.lifecycle |
124 | * |
125 | * @tparam reference_type must be a subclass of vcl::Window |
126 | */ |
127 | template<typename... Arg> [[nodiscard]] static VclPtr< reference_type > Create(Arg &&... arg) |
128 | { |
129 | return VclPtr< reference_type >( new reference_type(std::forward<Arg>(arg)...), SAL_NO_ACQUIRE ); |
130 | } |
131 | |
132 | /** Probably most common used: handle->someBodyOp(). |
133 | */ |
134 | reference_type * operator->() const |
135 | { |
136 | return m_rInnerRef.get(); |
137 | } |
138 | |
139 | /** Get the body. Can be used instead of operator->(). |
140 | I.e. handle->someBodyOp() and handle.get()->someBodyOp() |
141 | are the same. |
142 | */ |
143 | reference_type * get() const |
144 | { |
145 | return m_rInnerRef.get(); |
146 | } |
147 | |
148 | void set(reference_type *pBody) |
149 | { |
150 | m_rInnerRef.set(pBody); |
151 | } |
152 | |
153 | void reset(reference_type *pBody) |
154 | { |
155 | m_rInnerRef.set(pBody); |
156 | } |
157 | |
158 | /** Up-casting copy assignment operator. |
159 | |
160 | Does not work for up-casts to ambiguous bases. |
161 | |
162 | @param rRef another reference |
163 | */ |
164 | template<typename derived_type> |
165 | typename std::enable_if< |
166 | std::is_base_of<reference_type, derived_type>::value, |
167 | VclPtr &>::type |
168 | operator =(VclPtr<derived_type> const & rRef) |
169 | { |
170 | m_rInnerRef.set(rRef.get()); |
171 | return *this; |
172 | } |
173 | |
174 | VclPtr & operator =(reference_type * pBody) |
175 | { |
176 | m_rInnerRef.set(pBody); |
177 | return *this; |
178 | } |
179 | |
180 | operator reference_type * () const |
181 | { |
182 | return m_rInnerRef.get(); |
183 | } |
184 | |
185 | explicit operator bool () const |
186 | { |
187 | return m_rInnerRef.get() != nullptr; |
188 | } |
189 | |
190 | void clear() |
191 | { |
192 | m_rInnerRef.clear(); |
193 | } |
194 | |
195 | void reset() |
196 | { |
197 | m_rInnerRef.clear(); |
198 | } |
199 | |
200 | void disposeAndClear() |
201 | { |
202 | // hold it alive for the lifetime of this method |
203 | ::rtl::Reference<reference_type> aTmp(m_rInnerRef); |
204 | m_rInnerRef.clear(); // we should use some 'swap' method ideally ;-) |
205 | if (aTmp.get()) { |
206 | aTmp->disposeOnce(); |
207 | } |
208 | } |
209 | |
210 | /** Needed to place VclPtr's into STL collection. |
211 | */ |
212 | bool operator< (const VclPtr<reference_type> & handle) const |
213 | { |
214 | return (m_rInnerRef < handle.m_rInnerRef); |
215 | } |
216 | }; // class VclPtr |
217 | |
218 | template<typename T1, typename T2> |
219 | inline bool operator ==(VclPtr<T1> const & p1, VclPtr<T2> const & p2) { |
220 | return p1.get() == p2.get(); |
221 | } |
222 | |
223 | template<typename T> inline bool operator ==(VclPtr<T> const & p1, T const * p2) |
224 | { |
225 | return p1.get() == p2; |
226 | } |
227 | |
228 | template<typename T> inline bool operator ==(VclPtr<T> const & p1, T * p2) { |
229 | return p1.get() == p2; |
230 | } |
231 | |
232 | template<typename T> inline bool operator ==(T const * p1, VclPtr<T> const & p2) |
233 | { |
234 | return p1 == p2.get(); |
235 | } |
236 | |
237 | template<typename T> inline bool operator ==(T * p1, VclPtr<T> const & p2) { |
238 | return p1 == p2.get(); |
239 | } |
240 | |
241 | template<typename T1, typename T2> |
242 | inline bool operator !=(VclPtr<T1> const & p1, VclPtr<T2> const & p2) { |
243 | return !(p1 == p2); |
244 | } |
245 | |
246 | template<typename T> inline bool operator !=(VclPtr<T> const & p1, T const * p2) |
247 | { |
248 | return !(p1 == p2); |
249 | } |
250 | |
251 | template<typename T> inline bool operator !=(VclPtr<T> const & p1, T * p2) { |
252 | return !(p1 == p2); |
253 | } |
254 | |
255 | template<typename T> inline bool operator !=(T const * p1, VclPtr<T> const & p2) |
256 | { |
257 | return !(p1 == p2); |
258 | } |
259 | |
260 | template<typename T> inline bool operator !=(T * p1, VclPtr<T> const & p2) { |
261 | return !(p1 == p2); |
262 | } |
263 | |
264 | /** |
265 | * A construction helper for a temporary VclPtr. Since VclPtr types |
266 | * are created with a reference-count of one - to help fit into |
267 | * the existing code-flow; this helps us to construct them easily. |
268 | * see also VclPtr::Create and ScopedVclPtr |
269 | * |
270 | * For more details on the design please see vcl/README.lifecycle |
271 | * |
272 | * @param reference_type must be a subclass of vcl::Window |
273 | */ |
274 | template <class reference_type> |
275 | class SAL_WARN_UNUSED__attribute__((warn_unused)) VclPtrInstance final : public VclPtr<reference_type> |
276 | { |
277 | public: |
278 | template<typename... Arg> VclPtrInstance(Arg &&... arg) |
279 | : VclPtr<reference_type>( new reference_type(std::forward<Arg>(arg)...), SAL_NO_ACQUIRE ) |
280 | { |
281 | } |
282 | |
283 | /** |
284 | * Override and disallow this, to prevent people accidentally calling it and actually |
285 | * getting VclPtr::Create and getting a naked VclPtr<> instance |
286 | */ |
287 | template<typename... Arg> static VclPtrInstance< reference_type > Create(Arg &&... ) = delete; |
288 | }; |
289 | |
290 | template <class reference_type> |
291 | class ScopedVclPtr : public VclPtr<reference_type> |
292 | { |
293 | public: |
294 | /** Constructor... |
295 | */ |
296 | ScopedVclPtr() |
297 | : VclPtr<reference_type>() |
298 | {} |
299 | |
300 | /** Constructor |
301 | */ |
302 | ScopedVclPtr (reference_type * pBody) |
303 | : VclPtr<reference_type>(pBody) |
304 | {} |
305 | |
306 | /** Copy constructor... |
307 | */ |
308 | ScopedVclPtr (const VclPtr<reference_type> & handle) |
309 | : VclPtr<reference_type>(handle) |
310 | {} |
311 | |
312 | /** |
313 | Assignment that releases the last reference. |
314 | */ |
315 | void disposeAndReset(reference_type *pBody) |
316 | { |
317 | if (pBody != this->get()) { |
318 | VclPtr<reference_type>::disposeAndClear(); |
319 | VclPtr<reference_type>::set(pBody); |
320 | } |
321 | } |
322 | |
323 | /** |
324 | Assignment that releases the last reference. |
325 | */ |
326 | ScopedVclPtr<reference_type>& operator = (reference_type * pBody) |
327 | { |
328 | disposeAndReset(pBody); |
329 | return *this; |
330 | } |
331 | |
332 | /** Up-casting conversion constructor: Copies interface reference. |
333 | |
334 | Does not work for up-casts to ambiguous bases. For the special case of |
335 | up-casting to Reference< XInterface >, see the corresponding conversion |
336 | operator. |
337 | |
338 | @param rRef another reference |
339 | */ |
340 | template< class derived_type > |
341 | ScopedVclPtr( |
342 | const VclPtr< derived_type > & rRef, |
343 | typename std::enable_if< |
344 | std::is_base_of<reference_type, derived_type>::value, int>::type |
345 | = 0 ) |
346 | : VclPtr<reference_type>( rRef ) |
347 | { |
348 | } |
349 | |
350 | /** Up-casting assignment operator. |
351 | |
352 | Does not work for up-casts to ambiguous bases. |
353 | |
354 | @param rRef another VclPtr |
355 | */ |
356 | template<typename derived_type> |
357 | typename std::enable_if< |
358 | std::is_base_of<reference_type, derived_type>::value, |
359 | ScopedVclPtr &>::type |
360 | operator =(VclPtr<derived_type> const & rRef) |
361 | { |
362 | disposeAndReset(rRef.get()); |
363 | return *this; |
364 | } |
365 | |
366 | /** |
367 | * Override and disallow this, to prevent people accidentally calling it and actually |
368 | * getting VclPtr::Create and getting a naked VclPtr<> instance |
369 | */ |
370 | template<typename... Arg> static ScopedVclPtr< reference_type > Create(Arg &&... ) = delete; |
371 | |
372 | ~ScopedVclPtr() |
373 | { |
374 | VclPtr<reference_type>::disposeAndClear(); |
375 | assert(VclPtr<reference_type>::get() == nullptr)(static_cast <bool> (VclPtr<reference_type>::get( ) == nullptr) ? void (0) : __assert_fail ("VclPtr<reference_type>::get() == nullptr" , "/home/maarten/src/libreoffice/core/include/vcl/vclptr.hxx" , 375, __extension__ __PRETTY_FUNCTION__)); // make sure there are no lingering references |
376 | } |
377 | |
378 | private: |
379 | // Most likely we don't want this default copy-constructor. |
380 | ScopedVclPtr (const ScopedVclPtr<reference_type> &) = delete; |
381 | // And certainly we don't want a default assignment operator. |
382 | ScopedVclPtr<reference_type>& operator = (const ScopedVclPtr<reference_type> &) = delete; |
383 | // And disallow reset as that doesn't call disposeAndClear on the original reference |
384 | void reset() = delete; |
385 | void reset(reference_type *pBody) = delete; |
386 | |
387 | protected: |
388 | ScopedVclPtr (reference_type * pBody, __sal_NoAcquire) |
389 | : VclPtr<reference_type>(pBody, SAL_NO_ACQUIRE) |
390 | {} |
391 | }; |
392 | |
393 | /** |
394 | * A construction helper for ScopedVclPtr. Since VclPtr types are created |
395 | * with a reference-count of one - to help fit into the existing |
396 | * code-flow; this helps us to construct them easily. |
397 | * |
398 | * For more details on the design please see vcl/README.lifecycle |
399 | * |
400 | * @param reference_type must be a subclass of vcl::Window |
401 | */ |
402 | #if defined _MSC_VER |
403 | #pragma warning(push) |
404 | #pragma warning(disable: 4521) // " multiple copy constructors specified" |
405 | #endif |
406 | template <class reference_type> |
407 | class SAL_WARN_UNUSED__attribute__((warn_unused)) ScopedVclPtrInstance final : public ScopedVclPtr<reference_type> |
408 | { |
409 | public: |
410 | template<typename... Arg> ScopedVclPtrInstance(Arg &&... arg) |
411 | : ScopedVclPtr<reference_type>( new reference_type(std::forward<Arg>(arg)...), SAL_NO_ACQUIRE ) |
412 | { |
413 | } |
414 | |
415 | /** |
416 | * Override and disallow this, to prevent people accidentally calling it and actually |
417 | * getting VclPtr::Create and getting a naked VclPtr<> instance |
418 | */ |
419 | template<typename... Arg> static ScopedVclPtrInstance< reference_type > Create(Arg &&...) = delete; |
420 | |
421 | private: |
422 | // Prevent the above perfect forwarding ctor from hijacking (accidental) |
423 | // attempts at ScopedVclPtrInstance copy construction (where the hijacking |
424 | // would typically lead to somewhat obscure error messages); both non-const |
425 | // and const variants are needed here, as the ScopedVclPtr base class has a |
426 | // const--variant copy ctor, so the implicitly declared copy ctor for |
427 | // ScopedVclPtrInstance would also be the const variant, so non-const copy |
428 | // construction attempts would be hijacked by the perfect forwarding ctor; |
429 | // but if we only declared a non-const variant here, the const variant would |
430 | // no longer be implicitly declared (as there would already be an explicitly |
431 | // declared copy ctor), so const copy construction attempts would then be |
432 | // hijacked by the perfect forwarding ctor: |
433 | ScopedVclPtrInstance(ScopedVclPtrInstance &) = delete; |
434 | ScopedVclPtrInstance(ScopedVclPtrInstance const &) = delete; |
435 | }; |
436 | #if defined _MSC_VER |
437 | #pragma warning(pop) |
438 | #endif |
439 | |
440 | #endif // INCLUDED_VCL_PTR_HXX |
441 | |
442 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |
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 | #ifndef INCLUDED_RTL_REF_HXX | ||||||||
21 | #define INCLUDED_RTL_REF_HXX | ||||||||
22 | |||||||||
23 | #include "sal/config.h" | ||||||||
24 | |||||||||
25 | #include <cassert> | ||||||||
26 | #include <cstddef> | ||||||||
27 | #include <functional> | ||||||||
28 | #ifdef LIBO_INTERNAL_ONLY1 | ||||||||
29 | #include <type_traits> | ||||||||
30 | #endif | ||||||||
31 | |||||||||
32 | #include "sal/types.h" | ||||||||
33 | |||||||||
34 | namespace rtl | ||||||||
35 | { | ||||||||
36 | |||||||||
37 | /** Template reference class for reference type. | ||||||||
38 | */ | ||||||||
39 | template <class reference_type> | ||||||||
40 | class Reference | ||||||||
41 | { | ||||||||
42 | /** The <b>reference_type</b> body pointer. | ||||||||
43 | */ | ||||||||
44 | reference_type * m_pBody; | ||||||||
45 | |||||||||
46 | |||||||||
47 | public: | ||||||||
48 | /** Constructor... | ||||||||
49 | */ | ||||||||
50 | Reference() | ||||||||
51 | : m_pBody (NULL__null) | ||||||||
52 | {} | ||||||||
53 | |||||||||
54 | |||||||||
55 | /** Constructor... | ||||||||
56 | */ | ||||||||
57 | Reference (reference_type * pBody, __sal_NoAcquire) | ||||||||
58 | : m_pBody (pBody) | ||||||||
59 | { | ||||||||
60 | } | ||||||||
61 | |||||||||
62 | /** Constructor... | ||||||||
63 | */ | ||||||||
64 | Reference (reference_type * pBody) | ||||||||
65 | : m_pBody (pBody) | ||||||||
66 | { | ||||||||
67 | if (m_pBody) | ||||||||
68 | m_pBody->acquire(); | ||||||||
69 | } | ||||||||
70 | |||||||||
71 | /** Copy constructor... | ||||||||
72 | */ | ||||||||
73 | Reference (const Reference<reference_type> & handle) | ||||||||
74 | : m_pBody (handle.m_pBody) | ||||||||
75 | { | ||||||||
76 | if (m_pBody) | ||||||||
77 | m_pBody->acquire(); | ||||||||
78 | } | ||||||||
79 | |||||||||
80 | #ifdef LIBO_INTERNAL_ONLY1 | ||||||||
81 | /** Move constructor... | ||||||||
82 | */ | ||||||||
83 | Reference (Reference<reference_type> && handle) noexcept | ||||||||
84 | : m_pBody (handle.m_pBody) | ||||||||
85 | { | ||||||||
86 | handle.m_pBody = nullptr; | ||||||||
87 | } | ||||||||
88 | #endif | ||||||||
89 | |||||||||
90 | #if defined LIBO_INTERNAL_ONLY1 | ||||||||
91 | /** Up-casting conversion constructor: Copies interface reference. | ||||||||
92 | |||||||||
93 | Does not work for up-casts to ambiguous bases. | ||||||||
94 | |||||||||
95 | @param rRef another reference | ||||||||
96 | */ | ||||||||
97 | template< class derived_type > | ||||||||
98 | inline Reference( | ||||||||
99 | const Reference< derived_type > & rRef, | ||||||||
100 | std::enable_if_t<std::is_base_of_v<reference_type, derived_type>, int> = 0 ) | ||||||||
101 | : m_pBody (rRef.get()) | ||||||||
102 | { | ||||||||
103 | if (m_pBody) | ||||||||
104 | m_pBody->acquire(); | ||||||||
105 | } | ||||||||
106 | #endif | ||||||||
107 | |||||||||
108 | /** Destructor... | ||||||||
109 | */ | ||||||||
110 | ~Reference() COVERITY_NOEXCEPT_FALSE | ||||||||
111 | { | ||||||||
112 | if (m_pBody) | ||||||||
113 | m_pBody->release(); | ||||||||
114 | } | ||||||||
115 | |||||||||
116 | /** Set... | ||||||||
117 | Similar to assignment. | ||||||||
118 | */ | ||||||||
119 | Reference<reference_type> & | ||||||||
120 | SAL_CALL set (reference_type * pBody) | ||||||||
121 | { | ||||||||
122 | if (pBody) | ||||||||
123 | pBody->acquire(); | ||||||||
124 | reference_type * const pOld = m_pBody; | ||||||||
125 | m_pBody = pBody; | ||||||||
126 | if (pOld) | ||||||||
127 | pOld->release(); | ||||||||
128 | return *this; | ||||||||
129 | } | ||||||||
130 | |||||||||
131 | /** Assignment. | ||||||||
132 | Unbinds this instance from its body (if bound) and | ||||||||
133 | bind it to the body represented by the handle. | ||||||||
134 | */ | ||||||||
135 | Reference<reference_type> & | ||||||||
136 | SAL_CALL operator= (const Reference<reference_type> & handle) | ||||||||
137 | { | ||||||||
138 | return set( handle.m_pBody ); | ||||||||
139 | } | ||||||||
140 | |||||||||
141 | #ifdef LIBO_INTERNAL_ONLY1 | ||||||||
142 | /** Assignment. | ||||||||
143 | * Unbinds this instance from its body (if bound), | ||||||||
144 | * bind it to the body represented by the handle, and | ||||||||
145 | * set the body represented by the handle to nullptr. | ||||||||
146 | */ | ||||||||
147 | Reference<reference_type> & | ||||||||
148 | operator= (Reference<reference_type> && handle) | ||||||||
149 | { | ||||||||
150 | // self-movement guts ourself | ||||||||
151 | if (m_pBody) | ||||||||
152 | m_pBody->release(); | ||||||||
153 | m_pBody = handle.m_pBody; | ||||||||
154 | handle.m_pBody = nullptr; | ||||||||
155 | return *this; | ||||||||
156 | } | ||||||||
157 | #endif | ||||||||
158 | |||||||||
159 | /** Assignment... | ||||||||
160 | */ | ||||||||
161 | Reference<reference_type> & | ||||||||
162 | SAL_CALL operator= (reference_type * pBody) | ||||||||
163 | { | ||||||||
164 | return set( pBody ); | ||||||||
165 | } | ||||||||
166 | |||||||||
167 | /** Unbind the body from this handle. | ||||||||
168 | Note that for a handle representing a large body, | ||||||||
169 | "handle.clear().set(new body());" _might_ | ||||||||
170 | perform a little bit better than "handle.set(new body());", | ||||||||
171 | since in the second case two large objects exist in memory | ||||||||
172 | (the old body and the new body). | ||||||||
173 | */ | ||||||||
174 | Reference<reference_type> & SAL_CALL clear() | ||||||||
175 | { | ||||||||
176 | if (m_pBody
| ||||||||
177 | { | ||||||||
178 | reference_type * const pOld = m_pBody; | ||||||||
179 | m_pBody = NULL__null; | ||||||||
180 | pOld->release(); | ||||||||
181 | } | ||||||||
182 | return *this; | ||||||||
183 | } | ||||||||
184 | |||||||||
185 | |||||||||
186 | /** Get the body. Can be used instead of operator->(). | ||||||||
187 | I.e. handle->someBodyOp() and handle.get()->someBodyOp() | ||||||||
188 | are the same. | ||||||||
189 | */ | ||||||||
190 | reference_type * SAL_CALL get() const | ||||||||
191 | { | ||||||||
192 | return m_pBody; | ||||||||
| |||||||||
193 | } | ||||||||
194 | |||||||||
195 | |||||||||
196 | /** Probably most common used: handle->someBodyOp(). | ||||||||
197 | */ | ||||||||
198 | reference_type * SAL_CALL operator->() const | ||||||||
199 | { | ||||||||
200 | assert(m_pBody != NULL)(static_cast <bool> (m_pBody != __null) ? void (0) : __assert_fail ("m_pBody != NULL", "/home/maarten/src/libreoffice/core/include/rtl/ref.hxx" , 200, __extension__ __PRETTY_FUNCTION__)); | ||||||||
201 | return m_pBody; | ||||||||
202 | } | ||||||||
203 | |||||||||
204 | |||||||||
205 | /** Allows (*handle).someBodyOp(). | ||||||||
206 | */ | ||||||||
207 | reference_type & SAL_CALL operator*() const | ||||||||
208 | { | ||||||||
209 | assert(m_pBody != NULL)(static_cast <bool> (m_pBody != __null) ? void (0) : __assert_fail ("m_pBody != NULL", "/home/maarten/src/libreoffice/core/include/rtl/ref.hxx" , 209, __extension__ __PRETTY_FUNCTION__)); | ||||||||
210 | return *m_pBody; | ||||||||
211 | } | ||||||||
212 | |||||||||
213 | |||||||||
214 | /** Returns True if the handle does point to a valid body. | ||||||||
215 | */ | ||||||||
216 | bool SAL_CALL is() const | ||||||||
217 | { | ||||||||
218 | return (m_pBody != NULL__null); | ||||||||
219 | } | ||||||||
220 | |||||||||
221 | #if defined LIBO_INTERNAL_ONLY1 | ||||||||
222 | /** Returns True if the handle does point to a valid body. | ||||||||
223 | */ | ||||||||
224 | explicit operator bool() const | ||||||||
225 | { | ||||||||
226 | return is(); | ||||||||
227 | } | ||||||||
228 | #endif | ||||||||
229 | |||||||||
230 | /** Returns True if this points to pBody. | ||||||||
231 | */ | ||||||||
232 | bool SAL_CALL operator== (const reference_type * pBody) const | ||||||||
233 | { | ||||||||
234 | return (m_pBody == pBody); | ||||||||
235 | } | ||||||||
236 | |||||||||
237 | |||||||||
238 | /** Returns True if handle points to the same body. | ||||||||
239 | */ | ||||||||
240 | bool | ||||||||
241 | SAL_CALL operator== (const Reference<reference_type> & handle) const | ||||||||
242 | { | ||||||||
243 | return (m_pBody == handle.m_pBody); | ||||||||
244 | } | ||||||||
245 | |||||||||
246 | |||||||||
247 | /** Needed to place References into STL collection. | ||||||||
248 | */ | ||||||||
249 | bool | ||||||||
250 | SAL_CALL operator!= (const Reference<reference_type> & handle) const | ||||||||
251 | { | ||||||||
252 | return (m_pBody != handle.m_pBody); | ||||||||
253 | } | ||||||||
254 | |||||||||
255 | |||||||||
256 | /** Needed to place References into STL collection. | ||||||||
257 | */ | ||||||||
258 | bool | ||||||||
259 | SAL_CALL operator< (const Reference<reference_type> & handle) const | ||||||||
260 | { | ||||||||
261 | return (m_pBody < handle.m_pBody); | ||||||||
262 | } | ||||||||
263 | |||||||||
264 | |||||||||
265 | /** Needed to place References into STL collection. | ||||||||
266 | */ | ||||||||
267 | bool | ||||||||
268 | SAL_CALL operator> (const Reference<reference_type> & handle) const | ||||||||
269 | { | ||||||||
270 | return (m_pBody > handle.m_pBody); | ||||||||
271 | } | ||||||||
272 | }; | ||||||||
273 | |||||||||
274 | } // namespace rtl | ||||||||
275 | |||||||||
276 | #if defined LIBO_INTERNAL_ONLY1 | ||||||||
277 | namespace std | ||||||||
278 | { | ||||||||
279 | |||||||||
280 | /// @cond INTERNAL | ||||||||
281 | /** | ||||||||
282 | Make rtl::Reference hashable by default for use in STL containers. | ||||||||
283 | |||||||||
284 | @since LibreOffice 6.3 | ||||||||
285 | */ | ||||||||
286 | template<typename T> | ||||||||
287 | struct hash<::rtl::Reference<T>> | ||||||||
288 | { | ||||||||
289 | std::size_t operator()(::rtl::Reference<T> const & s) const | ||||||||
290 | { return std::size_t(s.get()); } | ||||||||
291 | }; | ||||||||
292 | /// @endcond | ||||||||
293 | |||||||||
294 | } | ||||||||
295 | |||||||||
296 | #endif | ||||||||
297 | |||||||||
298 | #endif /* ! INCLUDED_RTL_REF_HXX */ | ||||||||
299 | |||||||||
300 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |
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 | #ifndef INCLUDED_VCL_Reference_HXX |
20 | #define INCLUDED_VCL_Reference_HXX |
21 | |
22 | #include <vcl/dllapi.h> |
23 | #include <osl/interlck.h> |
24 | |
25 | class VCL_DLLPUBLIC__attribute__ ((visibility("default"))) VclReferenceBase |
26 | { |
27 | mutable oslInterlockedCount mnRefCnt; |
28 | |
29 | template<typename T> friend class VclPtr; |
30 | |
31 | public: |
32 | void acquire() const |
33 | { |
34 | osl_atomic_increment(&mnRefCnt)__sync_add_and_fetch((&mnRefCnt), 1); |
35 | } |
36 | |
37 | void release() const |
38 | { |
39 | if (osl_atomic_decrement(&mnRefCnt)__sync_sub_and_fetch((&mnRefCnt), 1) == 0) |
40 | delete this; |
41 | } |
42 | #ifdef DBG_UTIL |
43 | #ifndef _WIN32 |
44 | sal_Int32 getRefCount() const { return mnRefCnt; } |
45 | #endif |
46 | #endif |
47 | |
48 | |
49 | private: |
50 | VclReferenceBase(const VclReferenceBase&) = delete; |
51 | VclReferenceBase& operator=(const VclReferenceBase&) = delete; |
52 | |
53 | bool mbDisposed : 1; |
54 | |
55 | protected: |
56 | VclReferenceBase(); |
57 | protected: |
58 | virtual ~VclReferenceBase(); |
59 | |
60 | protected: |
61 | virtual void dispose(); |
62 | |
63 | public: |
64 | void disposeOnce(); |
65 | bool isDisposed() const { return mbDisposed; } |
66 | |
67 | }; |
68 | #endif |