1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sd.hxx"
30 #include "AccessiblePresentationOLEShape.hxx"
31 
32 #include "SdShapeTypes.hxx"
33 
34 #include <svx/DescriptionGenerator.hxx>
35 #include <rtl/ustring.h>
36 
37 using namespace ::rtl;
38 using namespace ::com::sun::star;
39 using namespace	::com::sun::star::accessibility;
40 
41 namespace accessibility {
42 
43 //=====  internal  ============================================================
44 
45 AccessiblePresentationOLEShape::AccessiblePresentationOLEShape (
46     const AccessibleShapeInfo& rShapeInfo,
47     const AccessibleShapeTreeInfo& rShapeTreeInfo)
48     :   AccessibleOLEShape (rShapeInfo, rShapeTreeInfo)
49 {
50 }
51 
52 
53 
54 
55 AccessiblePresentationOLEShape::~AccessiblePresentationOLEShape (void)
56 {
57 }
58 
59 
60 
61 
62 //=====  XServiceInfo  ========================================================
63 
64 ::rtl::OUString SAL_CALL
65     AccessiblePresentationOLEShape::getImplementationName (void)
66     throw (::com::sun::star::uno::RuntimeException)
67 {
68 	return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessiblePresentationOLEShape"));
69 }
70 
71 
72 
73 
74 ///	Set this object's name if it is different to the current name.
75 ::rtl::OUString
76     AccessiblePresentationOLEShape::CreateAccessibleBaseName (void)
77     throw (::com::sun::star::uno::RuntimeException)
78 {
79     ::rtl::OUString sName;
80 
81     ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
82     switch (nShapeType)
83     {
84         case PRESENTATION_OLE:
85             sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressOLE"));
86             break;
87         case PRESENTATION_CHART:
88             sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressChart"));
89             break;
90         case PRESENTATION_TABLE:
91             sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressTable"));
92             break;
93         default:
94             sName = ::rtl::OUString (
95                 RTL_CONSTASCII_USTRINGPARAM("UnknownAccessibleImpressOLEShape"));
96             uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
97             if (xDescriptor.is())
98                 sName += ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM(": "))
99                     + xDescriptor->getShapeType();
100     }
101 
102     return sName;
103 }
104 
105 
106 
107 
108 ::rtl::OUString
109     AccessiblePresentationOLEShape::CreateAccessibleDescription (void)
110     throw (::com::sun::star::uno::RuntimeException)
111 {
112     //    return createAccessibleName();
113     DescriptionGenerator aDG (mxShape);
114     ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
115     switch (nShapeType)
116     {
117         case PRESENTATION_OLE:
118             aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationOLEShape"));
119             //SVX_RESSTR(RID_SVXSTR_A11Y_ST_RECTANGLE));
120             aDG.AddProperty (OUString::createFromAscii ("CLSID"),
121                 DescriptionGenerator::STRING);
122             break;
123         case PRESENTATION_CHART:
124             aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationChartShape"));
125             //SVX_RESSTR(RID_SVXSTR_A11Y_ST_RECTANGLE));
126             aDG.AddProperty (OUString::createFromAscii ("CLSID"),
127                 DescriptionGenerator::STRING);
128             break;
129         case PRESENTATION_TABLE:
130             aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationTableShape"));
131             //SVX_RESSTR(RID_SVXSTR_A11Y_ST_RECTANGLE));
132             aDG.AddProperty (OUString::createFromAscii ("CLSID"),
133                 DescriptionGenerator::STRING);
134             break;
135         default:
136             aDG.Initialize (::rtl::OUString::createFromAscii ("Unknown accessible presentation OLE shape"));
137             uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
138             if (xDescriptor.is())
139             {
140                 aDG.AppendString (::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("service name=")));
141                 aDG.AppendString (xDescriptor->getShapeType());
142             }
143     }
144 
145     return aDG();
146 }
147 
148 } // end of namespace accessibility
149