xref: /AOO41X/main/svx/source/accessibility/DescriptionGenerator.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_svx.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "svx/DescriptionGenerator.hxx"
32*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyState.hpp>
33*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
34*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyState.hpp>
35*cdf0e10cSrcweir #include <com/sun/star/container/XChild.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp>
38*cdf0e10cSrcweir #include <com/sun/star/container/XNamed.hpp>
39*cdf0e10cSrcweir #include <com/sun/star/drawing/FillStyle.hpp>
40*cdf0e10cSrcweir #include <com/sun/star/drawing/XShapes.hpp>
41*cdf0e10cSrcweir #include <com/sun/star/drawing/XShapeDescriptor.hpp>
42*cdf0e10cSrcweir #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
43*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
44*cdf0e10cSrcweir #include <com/sun/star/style/XStyle.hpp>
45*cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
46*cdf0e10cSrcweir #include <vos/mutex.hxx>
47*cdf0e10cSrcweir #include <vcl/svapp.hxx>
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir #include <com/sun/star/uno/Exception.hpp>
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir // Includes for string resources.
52*cdf0e10cSrcweir #ifndef _SVX_ACCESSIBILITY_HRC
53*cdf0e10cSrcweir #include "accessibility.hrc"
54*cdf0e10cSrcweir #endif
55*cdf0e10cSrcweir #include "svx/svdstr.hrc"
56*cdf0e10cSrcweir #include <svx/dialmgr.hxx>
57*cdf0e10cSrcweir #include <tools/string.hxx>
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir #include <svx/xdef.hxx>
60*cdf0e10cSrcweir #include "svx/unoapi.hxx"
61*cdf0e10cSrcweir #include "accessibility.hrc"
62*cdf0e10cSrcweir #include "DGColorNameLookUp.hxx"
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir using namespace ::rtl;
65*cdf0e10cSrcweir using namespace ::com::sun::star;
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir void SvxUnogetInternalNameForItem( const sal_Int16 nWhich, const rtl::OUString& rApiName, String& rInternalName ) throw();
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir namespace accessibility {
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir DescriptionGenerator::DescriptionGenerator (
74*cdf0e10cSrcweir     const uno::Reference<drawing::XShape>& xShape)
75*cdf0e10cSrcweir     : mxShape (xShape),
76*cdf0e10cSrcweir       mxSet (mxShape, uno::UNO_QUERY),
77*cdf0e10cSrcweir       mbIsFirstProperty (true)
78*cdf0e10cSrcweir {
79*cdf0e10cSrcweir }
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir DescriptionGenerator::~DescriptionGenerator (void)
85*cdf0e10cSrcweir {
86*cdf0e10cSrcweir }
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir void DescriptionGenerator::Initialize (sal_Int32 nResourceId)
92*cdf0e10cSrcweir {
93*cdf0e10cSrcweir     // Get the string from the resource for the specified id.
94*cdf0e10cSrcweir     OUString sPrefix;
95*cdf0e10cSrcweir     {
96*cdf0e10cSrcweir         ::vos::OGuard aGuard (::Application::GetSolarMutex());
97*cdf0e10cSrcweir         sPrefix = OUString (SVX_RESSTR (nResourceId));
98*cdf0e10cSrcweir     }
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir     // Forward the call with the resulting string.
101*cdf0e10cSrcweir     Initialize (sPrefix);
102*cdf0e10cSrcweir }
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir void DescriptionGenerator::Initialize (::rtl::OUString sPrefix)
108*cdf0e10cSrcweir {
109*cdf0e10cSrcweir     msDescription = sPrefix;
110*cdf0e10cSrcweir     if (mxSet.is())
111*cdf0e10cSrcweir     {
112*cdf0e10cSrcweir         {
113*cdf0e10cSrcweir             ::vos::OGuard aGuard (::Application::GetSolarMutex());
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir             msDescription.append (sal_Unicode (' '));
116*cdf0e10cSrcweir             msDescription.append (OUString (SVX_RESSTR(RID_SVXSTR_A11Y_WITH)));
117*cdf0e10cSrcweir             msDescription.append (sal_Unicode (' '));
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir             msDescription.append (OUString (SVX_RESSTR (RID_SVXSTR_A11Y_STYLE)));
120*cdf0e10cSrcweir             msDescription.append (sal_Unicode ('='));
121*cdf0e10cSrcweir         }
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir         try
124*cdf0e10cSrcweir         {
125*cdf0e10cSrcweir             if (mxSet.is())
126*cdf0e10cSrcweir             {
127*cdf0e10cSrcweir                 uno::Any aValue = mxSet->getPropertyValue (OUString::createFromAscii ("Style"));
128*cdf0e10cSrcweir                 uno::Reference<container::XNamed> xStyle (aValue, uno::UNO_QUERY);
129*cdf0e10cSrcweir                 if (xStyle.is())
130*cdf0e10cSrcweir                     msDescription.append (xStyle->getName());
131*cdf0e10cSrcweir             }
132*cdf0e10cSrcweir             else
133*cdf0e10cSrcweir                 msDescription.append (
134*cdf0e10cSrcweir                     OUString::createFromAscii("<no style>"));
135*cdf0e10cSrcweir         }
136*cdf0e10cSrcweir         catch (::com::sun::star::beans::UnknownPropertyException)
137*cdf0e10cSrcweir         {
138*cdf0e10cSrcweir             msDescription.append (
139*cdf0e10cSrcweir                 OUString::createFromAscii("<unknown>"));
140*cdf0e10cSrcweir         }
141*cdf0e10cSrcweir     }
142*cdf0e10cSrcweir }
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir ::rtl::OUString DescriptionGenerator::operator() (void)
148*cdf0e10cSrcweir {
149*cdf0e10cSrcweir     msDescription.append (sal_Unicode ('.'));
150*cdf0e10cSrcweir     return msDescription.makeStringAndClear();
151*cdf0e10cSrcweir }
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir void DescriptionGenerator::AddProperty (
157*cdf0e10cSrcweir     const OUString& sPropertyName,
158*cdf0e10cSrcweir     PropertyType aType,
159*cdf0e10cSrcweir     const sal_Int32 nLocalizedNameId,
160*cdf0e10cSrcweir     long nWhichId)
161*cdf0e10cSrcweir {
162*cdf0e10cSrcweir     OUString sLocalizedName;
163*cdf0e10cSrcweir     {
164*cdf0e10cSrcweir         ::vos::OGuard aGuard (::Application::GetSolarMutex());
165*cdf0e10cSrcweir         sLocalizedName = SVX_RESSTR (nLocalizedNameId);
166*cdf0e10cSrcweir     }
167*cdf0e10cSrcweir     AddProperty (sPropertyName, aType, sLocalizedName, nWhichId);
168*cdf0e10cSrcweir }
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir void DescriptionGenerator::AddProperty (const OUString& sPropertyName,
174*cdf0e10cSrcweir     PropertyType aType, const OUString& sLocalizedName, long nWhichId)
175*cdf0e10cSrcweir {
176*cdf0e10cSrcweir     uno::Reference<beans::XPropertyState> xState (mxShape, uno::UNO_QUERY);
177*cdf0e10cSrcweir     if (xState.is()
178*cdf0e10cSrcweir         && xState->getPropertyState(sPropertyName)!=beans::PropertyState_DEFAULT_VALUE)
179*cdf0e10cSrcweir         if (mxSet.is())
180*cdf0e10cSrcweir         {
181*cdf0e10cSrcweir             // Append a seperator from previous Properties.
182*cdf0e10cSrcweir             if ( ! mbIsFirstProperty)
183*cdf0e10cSrcweir                 msDescription.append (sal_Unicode (','));
184*cdf0e10cSrcweir             else
185*cdf0e10cSrcweir             {
186*cdf0e10cSrcweir                 ::vos::OGuard aGuard (::Application::GetSolarMutex());
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir                 msDescription.append (sal_Unicode (' '));
189*cdf0e10cSrcweir                 msDescription.append (OUString (SVX_RESSTR(RID_SVXSTR_A11Y_AND)));
190*cdf0e10cSrcweir                 msDescription.append (sal_Unicode (' '));
191*cdf0e10cSrcweir                 mbIsFirstProperty = false;
192*cdf0e10cSrcweir             }
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir             // Delegate to type specific property handling.
195*cdf0e10cSrcweir             switch (aType)
196*cdf0e10cSrcweir             {
197*cdf0e10cSrcweir                 case COLOR:
198*cdf0e10cSrcweir                     AddColor (sPropertyName, sLocalizedName);
199*cdf0e10cSrcweir                     break;
200*cdf0e10cSrcweir                 case INTEGER:
201*cdf0e10cSrcweir                     AddInteger (sPropertyName, sLocalizedName);
202*cdf0e10cSrcweir                     break;
203*cdf0e10cSrcweir                 case STRING:
204*cdf0e10cSrcweir                     AddString (sPropertyName, sLocalizedName, nWhichId);
205*cdf0e10cSrcweir                     break;
206*cdf0e10cSrcweir                 case FILL_STYLE:
207*cdf0e10cSrcweir                     AddFillStyle (sPropertyName, sLocalizedName);
208*cdf0e10cSrcweir                     break;
209*cdf0e10cSrcweir             }
210*cdf0e10cSrcweir         }
211*cdf0e10cSrcweir }
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir void DescriptionGenerator::AppendString (const ::rtl::OUString& sString)
217*cdf0e10cSrcweir {
218*cdf0e10cSrcweir     msDescription.append (sString);
219*cdf0e10cSrcweir }
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir 
223*cdf0e10cSrcweir 
224*cdf0e10cSrcweir void DescriptionGenerator::AddLineProperties (void)
225*cdf0e10cSrcweir {
226*cdf0e10cSrcweir     AddProperty (OUString::createFromAscii ("LineColor"),
227*cdf0e10cSrcweir         DescriptionGenerator::COLOR,
228*cdf0e10cSrcweir         SIP_XA_LINECOLOR);
229*cdf0e10cSrcweir     AddProperty (OUString::createFromAscii ("LineDashName"),
230*cdf0e10cSrcweir         DescriptionGenerator::STRING,
231*cdf0e10cSrcweir         SIP_XA_LINEDASH,
232*cdf0e10cSrcweir         XATTR_LINEDASH);
233*cdf0e10cSrcweir     AddProperty (OUString::createFromAscii ("LineWidth"),
234*cdf0e10cSrcweir         DescriptionGenerator::INTEGER,
235*cdf0e10cSrcweir         SIP_XA_LINEWIDTH);
236*cdf0e10cSrcweir }
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir 
240*cdf0e10cSrcweir 
241*cdf0e10cSrcweir /** The fill style is described by the property "FillStyle".  Depending on
242*cdf0e10cSrcweir     its value a hatch-, gradient-, or bitmap name is appended.
243*cdf0e10cSrcweir */
244*cdf0e10cSrcweir void DescriptionGenerator::AddFillProperties (void)
245*cdf0e10cSrcweir {
246*cdf0e10cSrcweir     AddProperty (OUString::createFromAscii ("FillStyle"),
247*cdf0e10cSrcweir         DescriptionGenerator::FILL_STYLE,
248*cdf0e10cSrcweir         SIP_XA_FILLSTYLE);
249*cdf0e10cSrcweir }
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir 
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir 
254*cdf0e10cSrcweir void DescriptionGenerator::Add3DProperties (void)
255*cdf0e10cSrcweir {
256*cdf0e10cSrcweir     AddProperty (OUString::createFromAscii ("D3DMaterialColor"),
257*cdf0e10cSrcweir         DescriptionGenerator::COLOR,
258*cdf0e10cSrcweir         RID_SVXSTR_A11Y_3D_MATERIAL_COLOR);
259*cdf0e10cSrcweir     AddLineProperties ();
260*cdf0e10cSrcweir     AddFillProperties ();
261*cdf0e10cSrcweir }
262*cdf0e10cSrcweir 
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir 
265*cdf0e10cSrcweir 
266*cdf0e10cSrcweir void DescriptionGenerator::AddTextProperties (void)
267*cdf0e10cSrcweir {
268*cdf0e10cSrcweir     AddProperty (OUString::createFromAscii ("CharColor"),
269*cdf0e10cSrcweir         DescriptionGenerator::COLOR);
270*cdf0e10cSrcweir     AddFillProperties ();
271*cdf0e10cSrcweir }
272*cdf0e10cSrcweir 
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir 
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir /** Search for the given color in the global color table.  If found append
277*cdf0e10cSrcweir     its name to the description.  Otherwise append its RGB tuple.
278*cdf0e10cSrcweir */
279*cdf0e10cSrcweir void DescriptionGenerator::AddColor (const OUString& sPropertyName,
280*cdf0e10cSrcweir     const OUString& sLocalizedName)
281*cdf0e10cSrcweir {
282*cdf0e10cSrcweir     msDescription.append (sLocalizedName);
283*cdf0e10cSrcweir     msDescription.append (sal_Unicode('='));
284*cdf0e10cSrcweir 
285*cdf0e10cSrcweir     try
286*cdf0e10cSrcweir     {
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir         long nValue(0);
289*cdf0e10cSrcweir         if (mxSet.is())
290*cdf0e10cSrcweir         {
291*cdf0e10cSrcweir             uno::Any aValue = mxSet->getPropertyValue (sPropertyName);
292*cdf0e10cSrcweir             aValue >>= nValue;
293*cdf0e10cSrcweir         }
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir         msDescription.append (DGColorNameLookUp::Instance().LookUpColor (nValue));
296*cdf0e10cSrcweir     }
297*cdf0e10cSrcweir     catch (::com::sun::star::beans::UnknownPropertyException)
298*cdf0e10cSrcweir     {
299*cdf0e10cSrcweir         msDescription.append (
300*cdf0e10cSrcweir             OUString::createFromAscii("<unknown>"));
301*cdf0e10cSrcweir     }
302*cdf0e10cSrcweir }
303*cdf0e10cSrcweir 
304*cdf0e10cSrcweir 
305*cdf0e10cSrcweir 
306*cdf0e10cSrcweir 
307*cdf0e10cSrcweir void DescriptionGenerator::AddUnknown (const OUString& /*sPropertyName*/,
308*cdf0e10cSrcweir     const OUString& sLocalizedName)
309*cdf0e10cSrcweir {
310*cdf0e10cSrcweir     //        uno::Any aValue = mxSet->getPropertyValue (sPropertyName);
311*cdf0e10cSrcweir     msDescription.append (sLocalizedName);
312*cdf0e10cSrcweir }
313*cdf0e10cSrcweir 
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir 
316*cdf0e10cSrcweir 
317*cdf0e10cSrcweir void DescriptionGenerator::AddInteger (const OUString& sPropertyName,
318*cdf0e10cSrcweir     const OUString& sLocalizedName)
319*cdf0e10cSrcweir {
320*cdf0e10cSrcweir     msDescription.append (sLocalizedName);
321*cdf0e10cSrcweir     msDescription.append (sal_Unicode('='));
322*cdf0e10cSrcweir 
323*cdf0e10cSrcweir     try
324*cdf0e10cSrcweir     {
325*cdf0e10cSrcweir         if (mxSet.is())
326*cdf0e10cSrcweir         {
327*cdf0e10cSrcweir             uno::Any aValue = mxSet->getPropertyValue (sPropertyName);
328*cdf0e10cSrcweir             long nValue = 0;
329*cdf0e10cSrcweir             aValue >>= nValue;
330*cdf0e10cSrcweir             msDescription.append (nValue);
331*cdf0e10cSrcweir         }
332*cdf0e10cSrcweir     }
333*cdf0e10cSrcweir     catch (::com::sun::star::beans::UnknownPropertyException)
334*cdf0e10cSrcweir     {
335*cdf0e10cSrcweir         msDescription.append (
336*cdf0e10cSrcweir             OUString::createFromAscii("<unknown>"));
337*cdf0e10cSrcweir     }
338*cdf0e10cSrcweir }
339*cdf0e10cSrcweir 
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir 
342*cdf0e10cSrcweir 
343*cdf0e10cSrcweir void DescriptionGenerator::AddString (const OUString& sPropertyName,
344*cdf0e10cSrcweir     const OUString& sLocalizedName, long nWhichId)
345*cdf0e10cSrcweir {
346*cdf0e10cSrcweir     msDescription.append (sLocalizedName);
347*cdf0e10cSrcweir     msDescription.append (sal_Unicode('='));
348*cdf0e10cSrcweir 
349*cdf0e10cSrcweir     try
350*cdf0e10cSrcweir     {
351*cdf0e10cSrcweir         if (mxSet.is())
352*cdf0e10cSrcweir         {
353*cdf0e10cSrcweir             uno::Any aValue = mxSet->getPropertyValue (sPropertyName);
354*cdf0e10cSrcweir             OUString sValue;
355*cdf0e10cSrcweir             aValue >>= sValue;
356*cdf0e10cSrcweir 
357*cdf0e10cSrcweir             if (nWhichId >= 0)
358*cdf0e10cSrcweir             {
359*cdf0e10cSrcweir                 ::vos::OGuard aGuard (::Application::GetSolarMutex());
360*cdf0e10cSrcweir                 String sLocalizedValue;
361*cdf0e10cSrcweir                 SvxUnogetInternalNameForItem (sal::static_int_cast<sal_Int16>(nWhichId),
362*cdf0e10cSrcweir                                               sValue, sLocalizedValue);
363*cdf0e10cSrcweir                 msDescription.append (sLocalizedValue);
364*cdf0e10cSrcweir             }
365*cdf0e10cSrcweir             else
366*cdf0e10cSrcweir                 msDescription.append (sValue);
367*cdf0e10cSrcweir         }
368*cdf0e10cSrcweir     }
369*cdf0e10cSrcweir     catch (::com::sun::star::beans::UnknownPropertyException)
370*cdf0e10cSrcweir     {
371*cdf0e10cSrcweir         msDescription.append (
372*cdf0e10cSrcweir             OUString::createFromAscii("<unknown>"));
373*cdf0e10cSrcweir     }
374*cdf0e10cSrcweir }
375*cdf0e10cSrcweir 
376*cdf0e10cSrcweir 
377*cdf0e10cSrcweir 
378*cdf0e10cSrcweir 
379*cdf0e10cSrcweir void DescriptionGenerator::AddFillStyle (const OUString& sPropertyName,
380*cdf0e10cSrcweir     const OUString& sLocalizedName)
381*cdf0e10cSrcweir {
382*cdf0e10cSrcweir     msDescription.append (sLocalizedName);
383*cdf0e10cSrcweir     msDescription.append (sal_Unicode('='));
384*cdf0e10cSrcweir 
385*cdf0e10cSrcweir     try
386*cdf0e10cSrcweir     {
387*cdf0e10cSrcweir         if (mxSet.is())
388*cdf0e10cSrcweir         {
389*cdf0e10cSrcweir             uno::Any aValue = mxSet->getPropertyValue (sPropertyName);
390*cdf0e10cSrcweir             drawing::FillStyle aFillStyle;
391*cdf0e10cSrcweir             aValue >>= aFillStyle;
392*cdf0e10cSrcweir 
393*cdf0e10cSrcweir             // Get the fill style name from the resource.
394*cdf0e10cSrcweir             OUString sFillStyleName;
395*cdf0e10cSrcweir             {
396*cdf0e10cSrcweir                 ::vos::OGuard aGuard (::Application::GetSolarMutex());
397*cdf0e10cSrcweir                 switch (aFillStyle)
398*cdf0e10cSrcweir                 {
399*cdf0e10cSrcweir                     case drawing::FillStyle_NONE:
400*cdf0e10cSrcweir                         sFillStyleName = SVX_RESSTR(RID_SVXSTR_A11Y_FILLSTYLE_NONE);
401*cdf0e10cSrcweir                         break;
402*cdf0e10cSrcweir                     case drawing::FillStyle_SOLID:
403*cdf0e10cSrcweir                         sFillStyleName = SVX_RESSTR(RID_SVXSTR_A11Y_FILLSTYLE_SOLID);
404*cdf0e10cSrcweir                         break;
405*cdf0e10cSrcweir                     case drawing::FillStyle_GRADIENT:
406*cdf0e10cSrcweir                         sFillStyleName = SVX_RESSTR(RID_SVXSTR_A11Y_FILLSTYLE_GRADIENT);
407*cdf0e10cSrcweir                         break;
408*cdf0e10cSrcweir                     case drawing::FillStyle_HATCH:
409*cdf0e10cSrcweir                         sFillStyleName = SVX_RESSTR(RID_SVXSTR_A11Y_FILLSTYLE_HATCH);
410*cdf0e10cSrcweir                         break;
411*cdf0e10cSrcweir                     case drawing::FillStyle_BITMAP:
412*cdf0e10cSrcweir                         sFillStyleName = SVX_RESSTR(RID_SVXSTR_A11Y_FILLSTYLE_BITMAP);
413*cdf0e10cSrcweir                         break;
414*cdf0e10cSrcweir                     case drawing::FillStyle_MAKE_FIXED_SIZE:
415*cdf0e10cSrcweir                         break;
416*cdf0e10cSrcweir                 }
417*cdf0e10cSrcweir             }
418*cdf0e10cSrcweir             msDescription.append (sFillStyleName);
419*cdf0e10cSrcweir 
420*cdf0e10cSrcweir             // Append the appropriate properties.
421*cdf0e10cSrcweir             switch (aFillStyle)
422*cdf0e10cSrcweir             {
423*cdf0e10cSrcweir                 case drawing::FillStyle_NONE:
424*cdf0e10cSrcweir                     break;
425*cdf0e10cSrcweir                 case drawing::FillStyle_SOLID:
426*cdf0e10cSrcweir                     AddProperty (OUString::createFromAscii ("FillColor"),
427*cdf0e10cSrcweir                         COLOR,
428*cdf0e10cSrcweir                         SIP_XA_FILLCOLOR);
429*cdf0e10cSrcweir                     break;
430*cdf0e10cSrcweir                 case drawing::FillStyle_GRADIENT:
431*cdf0e10cSrcweir                     AddProperty (OUString::createFromAscii ("FillGradientName"),
432*cdf0e10cSrcweir                         STRING,
433*cdf0e10cSrcweir                         SIP_XA_FILLGRADIENT,
434*cdf0e10cSrcweir                         XATTR_FILLGRADIENT);
435*cdf0e10cSrcweir                     break;
436*cdf0e10cSrcweir                 case drawing::FillStyle_HATCH:
437*cdf0e10cSrcweir                     AddProperty (OUString::createFromAscii ("FillColor"),
438*cdf0e10cSrcweir                         COLOR,
439*cdf0e10cSrcweir                         SIP_XA_FILLCOLOR);
440*cdf0e10cSrcweir                     AddProperty (OUString::createFromAscii ("FillHatchName"),
441*cdf0e10cSrcweir                         STRING,
442*cdf0e10cSrcweir                         SIP_XA_FILLHATCH,
443*cdf0e10cSrcweir                         XATTR_FILLHATCH);
444*cdf0e10cSrcweir                     break;
445*cdf0e10cSrcweir                 case drawing::FillStyle_BITMAP:
446*cdf0e10cSrcweir                     AddProperty (OUString::createFromAscii ("FillBitmapName"),
447*cdf0e10cSrcweir                         STRING,
448*cdf0e10cSrcweir                         SIP_XA_FILLBITMAP,
449*cdf0e10cSrcweir                         XATTR_FILLBITMAP);
450*cdf0e10cSrcweir                     break;
451*cdf0e10cSrcweir                 case drawing::FillStyle_MAKE_FIXED_SIZE:
452*cdf0e10cSrcweir                     break;
453*cdf0e10cSrcweir             }
454*cdf0e10cSrcweir         }
455*cdf0e10cSrcweir     }
456*cdf0e10cSrcweir     catch (::com::sun::star::beans::UnknownPropertyException)
457*cdf0e10cSrcweir     {
458*cdf0e10cSrcweir         msDescription.append (
459*cdf0e10cSrcweir             OUString::createFromAscii("<unknown>"));
460*cdf0e10cSrcweir     }
461*cdf0e10cSrcweir }
462*cdf0e10cSrcweir 
463*cdf0e10cSrcweir 
464*cdf0e10cSrcweir 
465*cdf0e10cSrcweir 
466*cdf0e10cSrcweir void DescriptionGenerator::AddPropertyNames (void)
467*cdf0e10cSrcweir {
468*cdf0e10cSrcweir     if (mxSet.is())
469*cdf0e10cSrcweir     {
470*cdf0e10cSrcweir         uno::Reference<beans::XPropertySetInfo> xInfo (mxSet->getPropertySetInfo());
471*cdf0e10cSrcweir         if (xInfo.is())
472*cdf0e10cSrcweir         {
473*cdf0e10cSrcweir             uno::Sequence<beans::Property> aPropertyList (xInfo->getProperties ());
474*cdf0e10cSrcweir             for (int i=0; i<aPropertyList.getLength(); i++)
475*cdf0e10cSrcweir             {
476*cdf0e10cSrcweir                 msDescription.append (aPropertyList[i].Name);
477*cdf0e10cSrcweir                 msDescription.append (sal_Unicode(','));
478*cdf0e10cSrcweir             }
479*cdf0e10cSrcweir         }
480*cdf0e10cSrcweir     }
481*cdf0e10cSrcweir }
482*cdf0e10cSrcweir 
483*cdf0e10cSrcweir 
484*cdf0e10cSrcweir } // end of namespace accessibility
485