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