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