1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_sd.hxx" 26 #include "AccessiblePresentationShape.hxx" 27 28 #include "SdShapeTypes.hxx" 29 30 #include "accessibility.hrc" 31 #include "sdresid.hxx" 32 #include <tools/string.hxx> 33 #include <svx/DescriptionGenerator.hxx> 34 #include <rtl/ustring.h> 35 36 using namespace ::rtl; 37 using namespace ::com::sun::star; 38 using namespace ::com::sun::star::accessibility; 39 40 namespace accessibility { 41 42 //===== internal ============================================================ 43 44 AccessiblePresentationShape::AccessiblePresentationShape ( 45 const AccessibleShapeInfo& rShapeInfo, 46 const AccessibleShapeTreeInfo& rShapeTreeInfo) 47 : AccessibleShape (rShapeInfo, rShapeTreeInfo) 48 { 49 } 50 51 52 53 54 AccessiblePresentationShape::~AccessiblePresentationShape (void) 55 { 56 } 57 58 59 60 61 //===== XServiceInfo ======================================================== 62 63 ::rtl::OUString SAL_CALL 64 AccessiblePresentationShape::getImplementationName (void) 65 throw (::com::sun::star::uno::RuntimeException) 66 { 67 return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessiblePresentationShape")); 68 } 69 70 71 72 73 /// Set this object's name if is different to the current name. 74 ::rtl::OUString 75 AccessiblePresentationShape::CreateAccessibleBaseName (void) 76 throw (::com::sun::star::uno::RuntimeException) 77 { 78 ::rtl::OUString sName; 79 80 ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape); 81 switch (nShapeType) 82 { 83 case PRESENTATION_TITLE: 84 //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressTitle")); 85 sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_TITLE_N))); 86 break; 87 case PRESENTATION_OUTLINER: 88 //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressOutliner")); 89 sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_OUTLINER_N))); 90 break; 91 case PRESENTATION_SUBTITLE: 92 //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressSubtitle")); 93 sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_SUBTITLE_N))); 94 break; 95 case PRESENTATION_PAGE: 96 //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressPage")); 97 sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_PAGE_N))); 98 break; 99 case PRESENTATION_NOTES: 100 //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressNotes")); 101 sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_NOTES_N))); 102 break; 103 case PRESENTATION_HANDOUT: 104 //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressHandout")); 105 sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_HANDOUT_N))); 106 break; 107 case PRESENTATION_HEADER: 108 //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressHeader")); 109 sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_HEADER_N)) ); 110 break; 111 case PRESENTATION_FOOTER: 112 //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressFooter")); 113 sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_FOOTER_N)) ); 114 break; 115 case PRESENTATION_DATETIME: 116 //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressDateAndTime")); 117 sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_DATE_N)) ); 118 break; 119 case PRESENTATION_PAGENUMBER: 120 //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressPageNumber")); 121 sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_NUMBER_N)) ); 122 break; 123 default: 124 //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("UnknownAccessibleImpressShape")); 125 sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_UNKNOWN_N))); 126 uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY); 127 if (xDescriptor.is()) 128 sName += ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM(": ")) 129 + xDescriptor->getShapeType(); 130 } 131 132 return sName; 133 } 134 135 136 137 138 ::rtl::OUString 139 AccessiblePresentationShape::CreateAccessibleDescription (void) 140 throw (::com::sun::star::uno::RuntimeException) 141 { 142 // return createAccessibleName (); 143 ::rtl::OUString sDescription; 144 DescriptionGenerator aDG (mxShape); 145 ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape); 146 switch (nShapeType) 147 { 148 case PRESENTATION_TITLE: 149 //aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationTitleShape")); 150 sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_TITLE_D)) ); 151 aDG.Initialize (sDescription); 152 break; 153 case PRESENTATION_OUTLINER: 154 //aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationOutlinerShape")); 155 sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_OUTLINER_D)) ); 156 aDG.Initialize (sDescription); //PresentationOutlinerShape 157 break; 158 case PRESENTATION_SUBTITLE: 159 aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationSubtitleShape")); 160 sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_SUBTITLE_D)) ); 161 aDG.Initialize (sDescription); //PresentationSubtitleShape 162 break; 163 case PRESENTATION_PAGE: 164 aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationPageShape")); 165 sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_PAGE_D)) ); 166 aDG.Initialize (sDescription); //PresentationPageShape 167 break; 168 case PRESENTATION_NOTES: 169 aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationNotesShape")); 170 sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_NOTES_D)) ); 171 aDG.Initialize (sDescription); //PresentationNotesShape 172 break; 173 case PRESENTATION_HANDOUT: 174 aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationHandoutShape")); 175 sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_HANDOUT_D)) ); 176 aDG.Initialize (sDescription); //PresentationHandoutShape 177 break; 178 case PRESENTATION_HEADER: 179 //aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationHeaderShape")); 180 sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_HEADER_D)) ); 181 aDG.Initialize (sDescription); //PresentationHeaderShape 182 break; 183 case PRESENTATION_FOOTER: 184 //aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationFooterShape")); 185 sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_FOOTER_D)) ); 186 aDG.Initialize (sDescription); //PresentationFooterShape 187 break; 188 case PRESENTATION_DATETIME: 189 //aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationDateAndTimeShape")); 190 sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_DATE_D)) ); 191 aDG.Initialize (sDescription); //PresentationDateShape 192 break; 193 case PRESENTATION_PAGENUMBER: 194 //aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationPageNumberShape")); 195 sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_NUMBER_D)) ); 196 aDG.Initialize (sDescription); //PresentationNumberShape 197 break; 198 default: 199 //aDG.Initialize (::rtl::OUString::createFromAscii ("Unknown accessible presentation shape")); 200 sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_UNKNOWN_D)) ); 201 aDG.Initialize (sDescription); //Unknown accessible presentation shape 202 uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY); 203 if (xDescriptor.is()) 204 { 205 aDG.AppendString (::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("service name="))); 206 aDG.AppendString (xDescriptor->getShapeType()); 207 } 208 } 209 210 return aDG(); 211 } 212 ::rtl::OUString AccessiblePresentationShape::GetStyle() 213 { 214 ::rtl::OUString sName; 215 216 ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape); 217 switch (nShapeType) 218 { 219 case PRESENTATION_TITLE: 220 sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_TITLE_N_STYLE))); 221 break; 222 case PRESENTATION_OUTLINER: 223 sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_OUTLINER_N_STYLE))); 224 break; 225 case PRESENTATION_SUBTITLE: 226 sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_SUBTITLE_N_STYLE))); 227 break; 228 case PRESENTATION_PAGE: 229 sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_PAGE_N_STYLE))); 230 break; 231 case PRESENTATION_NOTES: 232 sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_NOTES_N_STYLE))); 233 break; 234 case PRESENTATION_HANDOUT: 235 sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_HANDOUT_N_STYLE))); 236 break; 237 case PRESENTATION_FOOTER: 238 sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_FOOTER_N_STYLE)) ); 239 break; 240 case PRESENTATION_HEADER: 241 sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_HEADER_N_STYLE)) ); 242 break; 243 case PRESENTATION_DATETIME: 244 sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_DATE_N_STYLE)) ); 245 break; 246 case PRESENTATION_PAGENUMBER: 247 sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_NUMBER_N_STYLE)) ); 248 break; 249 default: 250 sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_UNKNOWN_N_STYLE))); 251 uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY); 252 if (xDescriptor.is()) 253 sName += ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM(": ")) 254 + xDescriptor->getShapeType(); 255 } 256 257 return sName; 258 259 } 260 } // end of namespace accessibility 261