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 //IAccessibility2 Implementation 2009----- 31 #include "accessibility.hrc" 32 #include "sdresid.hxx" 33 #include <tools/string.hxx> 34 //-----IAccessibility2 Implementation 2009 35 #include <svx/DescriptionGenerator.hxx> 36 #include <rtl/ustring.h> 37 38 using namespace ::rtl; 39 using namespace ::com::sun::star; 40 using namespace ::com::sun::star::accessibility; 41 42 namespace accessibility { 43 44 //===== internal ============================================================ 45 46 AccessiblePresentationShape::AccessiblePresentationShape ( 47 const AccessibleShapeInfo& rShapeInfo, 48 const AccessibleShapeTreeInfo& rShapeTreeInfo) 49 : AccessibleShape (rShapeInfo, rShapeTreeInfo) 50 { 51 } 52 53 54 55 56 AccessiblePresentationShape::~AccessiblePresentationShape (void) 57 { 58 } 59 60 61 62 63 //===== XServiceInfo ======================================================== 64 65 ::rtl::OUString SAL_CALL 66 AccessiblePresentationShape::getImplementationName (void) 67 throw (::com::sun::star::uno::RuntimeException) 68 { 69 return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessiblePresentationShape")); 70 } 71 72 73 74 75 /// Set this object's name if is different to the current name. 76 ::rtl::OUString 77 AccessiblePresentationShape::CreateAccessibleBaseName (void) 78 throw (::com::sun::star::uno::RuntimeException) 79 { 80 ::rtl::OUString sName; 81 82 ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape); 83 switch (nShapeType) 84 { 85 //IAccessibility2 Implementation 2009----- 86 case PRESENTATION_TITLE: 87 //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressTitle")); 88 sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_TITLE_N))); 89 break; 90 case PRESENTATION_OUTLINER: 91 //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressOutliner")); 92 sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_OUTLINER_N))); 93 break; 94 case PRESENTATION_SUBTITLE: 95 //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressSubtitle")); 96 sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_SUBTITLE_N))); 97 break; 98 case PRESENTATION_PAGE: 99 //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressPage")); 100 sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_PAGE_N))); 101 break; 102 case PRESENTATION_NOTES: 103 //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressNotes")); 104 sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_NOTES_N))); 105 break; 106 case PRESENTATION_HANDOUT: 107 //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressHandout")); 108 sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_HANDOUT_N))); 109 break; 110 case PRESENTATION_HEADER: 111 //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressHeader")); 112 sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_HEADER_N)) ); 113 break; 114 case PRESENTATION_FOOTER: 115 //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressFooter")); 116 sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_FOOTER_N)) ); 117 break; 118 case PRESENTATION_DATETIME: 119 //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressDateAndTime")); 120 sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_DATE_N)) ); 121 break; 122 case PRESENTATION_PAGENUMBER: 123 //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressPageNumber")); 124 sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_NUMBER_N)) ); 125 break; 126 default: 127 //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("UnknownAccessibleImpressShape")); 128 sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_UNKNOWN_N))); 129 //-----IAccessibility2 Implementation 2009 130 uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY); 131 if (xDescriptor.is()) 132 sName += ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM(": ")) 133 + xDescriptor->getShapeType(); 134 } 135 136 return sName; 137 } 138 139 140 141 142 ::rtl::OUString 143 AccessiblePresentationShape::CreateAccessibleDescription (void) 144 throw (::com::sun::star::uno::RuntimeException) 145 { 146 // return createAccessibleName (); 147 ::rtl::OUString sDescription; 148 DescriptionGenerator aDG (mxShape); 149 ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape); 150 switch (nShapeType) 151 { 152 //IAccessibility2 Implementation 2009----- 153 case PRESENTATION_TITLE: 154 //aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationTitleShape")); 155 sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_TITLE_D)) ); 156 aDG.Initialize (sDescription); 157 break; 158 case PRESENTATION_OUTLINER: 159 //aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationOutlinerShape")); 160 sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_OUTLINER_D)) ); 161 aDG.Initialize (sDescription); //PresentationOutlinerShape 162 break; 163 case PRESENTATION_SUBTITLE: 164 aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationSubtitleShape")); 165 sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_SUBTITLE_D)) ); 166 aDG.Initialize (sDescription); //PresentationSubtitleShape 167 break; 168 case PRESENTATION_PAGE: 169 aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationPageShape")); 170 sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_PAGE_D)) ); 171 aDG.Initialize (sDescription); //PresentationPageShape 172 break; 173 case PRESENTATION_NOTES: 174 aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationNotesShape")); 175 sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_NOTES_D)) ); 176 aDG.Initialize (sDescription); //PresentationNotesShape 177 break; 178 case PRESENTATION_HANDOUT: 179 aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationHandoutShape")); 180 sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_HANDOUT_D)) ); 181 aDG.Initialize (sDescription); //PresentationHandoutShape 182 break; 183 case PRESENTATION_HEADER: 184 //aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationHeaderShape")); 185 sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_HEADER_D)) ); 186 aDG.Initialize (sDescription); //PresentationHeaderShape 187 break; 188 case PRESENTATION_FOOTER: 189 //aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationFooterShape")); 190 sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_FOOTER_D)) ); 191 aDG.Initialize (sDescription); //PresentationFooterShape 192 break; 193 case PRESENTATION_DATETIME: 194 //aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationDateAndTimeShape")); 195 sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_DATE_D)) ); 196 aDG.Initialize (sDescription); //PresentationDateShape 197 break; 198 case PRESENTATION_PAGENUMBER: 199 //aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationPageNumberShape")); 200 sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_NUMBER_D)) ); 201 aDG.Initialize (sDescription); //PresentationNumberShape 202 break; 203 default: 204 //aDG.Initialize (::rtl::OUString::createFromAscii ("Unknown accessible presentation shape")); 205 sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_UNKNOWN_D)) ); 206 aDG.Initialize (sDescription); //Unknown accessible presentation shape 207 //-----IAccessibility2 Implementation 2009 208 uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY); 209 if (xDescriptor.is()) 210 { 211 aDG.AppendString (::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("service name="))); 212 aDG.AppendString (xDescriptor->getShapeType()); 213 } 214 } 215 216 return aDG(); 217 } 218 //IAccessibility2 Implementation 2009----- 219 ::rtl::OUString AccessiblePresentationShape::GetStyle() 220 { 221 ::rtl::OUString sName; 222 223 ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape); 224 switch (nShapeType) 225 { 226 case PRESENTATION_TITLE: 227 sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_TITLE_N_STYLE))); 228 break; 229 case PRESENTATION_OUTLINER: 230 sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_OUTLINER_N_STYLE))); 231 break; 232 case PRESENTATION_SUBTITLE: 233 sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_SUBTITLE_N_STYLE))); 234 break; 235 case PRESENTATION_PAGE: 236 sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_PAGE_N_STYLE))); 237 break; 238 case PRESENTATION_NOTES: 239 sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_NOTES_N_STYLE))); 240 break; 241 case PRESENTATION_HANDOUT: 242 sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_HANDOUT_N_STYLE))); 243 break; 244 case PRESENTATION_FOOTER: 245 sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_FOOTER_N_STYLE)) ); 246 break; 247 case PRESENTATION_HEADER: 248 sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_HEADER_N_STYLE)) ); 249 break; 250 case PRESENTATION_DATETIME: 251 sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_DATE_N_STYLE)) ); 252 break; 253 case PRESENTATION_PAGENUMBER: 254 sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_NUMBER_N_STYLE)) ); 255 break; 256 default: 257 sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_UNKNOWN_N_STYLE))); 258 uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY); 259 if (xDescriptor.is()) 260 sName += ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM(": ")) 261 + xDescriptor->getShapeType(); 262 } 263 264 return sName; 265 266 } 267 //-----IAccessibility2 Implementation 2009 268 } // end of namespace accessibility 269