X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=libspi%2Ftext.c;h=7b369a720d38749e72e5b4d46c32e479368e2ebf;hb=262e6e147178e8744ddb24296a3d41f889400590;hp=afb4a7e6a6277dbcffa49502e1b15f9212e26625;hpb=d809d79f978308b8e2039e7958e6b5773950ed69;p=platform%2Fcore%2Fuifw%2Fat-spi2-atk.git diff --git a/libspi/text.c b/libspi/text.c index afb4a7e..7b369a7 100644 --- a/libspi/text.c +++ b/libspi/text.c @@ -28,6 +28,7 @@ #include #include +#include /* * This pulls the CORBA definitions for the "Accessibility::Accessible" server @@ -65,11 +66,12 @@ impl_getTextAfterOffset (PortableServer_Servant _servant, static CORBA_string impl_getTextAtOffset (PortableServer_Servant _servant, const CORBA_long offset, - const Accessibility_TEXT_BOUNDARY_TYPE - type, CORBA_long * startOffset, + const Accessibility_TEXT_BOUNDARY_TYPE type, + CORBA_long * startOffset, CORBA_long * endOffset, CORBA_Environment * ev); -static CORBA_wchar + +static CORBA_unsigned_long impl_getCharacterAtOffset (PortableServer_Servant _servant, const CORBA_long offset, CORBA_Environment * ev); @@ -235,10 +237,16 @@ impl_getText (PortableServer_Servant _servant, const CORBA_long endOffset, CORBA_Environment * ev) { - Text *text = TEXT (bonobo_object_from_servant (_servant)); + Text *text; gchar *txt; CORBA_char *rv; - + BonoboObject *obj; + + obj = (bonobo_object_from_servant (_servant)); + g_return_val_if_fail (IS_TEXT (obj), (CORBA_char *)""); + text = TEXT (obj); + g_return_val_if_fail (ATK_IS_TEXT (text->atko), (CORBA_char *)""); + txt = atk_text_get_text (ATK_TEXT(text->atko), (gint) startOffset, (gint) endOffset); if (txt) @@ -262,14 +270,23 @@ impl_getTextAfterOffset (PortableServer_Servant _servant, CORBA_long * endOffset, CORBA_Environment * ev) { - Text *text = TEXT (bonobo_object_from_servant (_servant)); + Text *text; gchar *txt; CORBA_char *rv; + gint intStartOffset, intEndOffset; + BonoboObject *obj; - + obj = (bonobo_object_from_servant (_servant)); + g_return_val_if_fail (IS_TEXT (obj), (CORBA_char *)""); + text = TEXT (obj); + g_return_val_if_fail (ATK_IS_TEXT (text->atko), (CORBA_char *)""); + txt = atk_text_get_text_after_offset (ATK_TEXT(text->atko), (gint) offset, (AtkTextBoundary) type, - (gint *) startOffset, (gint *) endOffset); + &intStartOffset, &intEndOffset); + *startOffset = (CORBA_long) intStartOffset; + *endOffset = (CORBA_long) intEndOffset; + if (txt) { rv = CORBA_string_dup (txt); @@ -285,18 +302,28 @@ impl_getTextAfterOffset (PortableServer_Servant _servant, static CORBA_string impl_getTextAtOffset (PortableServer_Servant _servant, const CORBA_long offset, - const Accessibility_TEXT_BOUNDARY_TYPE - type, CORBA_long * startOffset, + const Accessibility_TEXT_BOUNDARY_TYPE type, + CORBA_long * startOffset, CORBA_long * endOffset, CORBA_Environment * ev) { - Text *text = TEXT (bonobo_object_from_servant (_servant)); - gchar *txt; + Text *text; + CORBA_char *txt; CORBA_char *rv; + gint intStartOffset, intEndOffset; + BonoboObject *obj; - txt = atk_text_get_text_at_offset (ATK_TEXT(text->atko), + obj = (bonobo_object_from_servant (_servant)); + g_return_val_if_fail (IS_TEXT (obj), (CORBA_char *)""); + text = TEXT (obj); + g_return_val_if_fail (ATK_IS_TEXT (text->atko), (CORBA_char *)""); + + txt = (CORBA_char *) atk_text_get_text_at_offset (ATK_TEXT (text->atko), (gint) offset, (AtkTextBoundary) type, - (gint *) startOffset, (gint *) endOffset); + &intStartOffset, &intEndOffset); + *startOffset = (CORBA_long) intStartOffset; + *endOffset = (CORBA_long) intEndOffset; + if (txt) { rv = CORBA_string_dup (txt); @@ -304,18 +331,25 @@ impl_getTextAtOffset (PortableServer_Servant _servant, } else rv = CORBA_string_dup (""); + return rv; } - -static CORBA_wchar +static CORBA_unsigned_long impl_getCharacterAtOffset (PortableServer_Servant _servant, const CORBA_long offset, CORBA_Environment * ev) { - Text *text = TEXT (bonobo_object_from_servant (_servant)); - return (CORBA_wchar) + Text *text; + BonoboObject *obj; + obj = (bonobo_object_from_servant (_servant)); + + g_return_val_if_fail (IS_TEXT (obj), (CORBA_unsigned_long)0); + text = TEXT (obj); + g_return_val_if_fail (ATK_IS_TEXT (text->atko), (CORBA_unsigned_long)0); + + return (CORBA_unsigned_long) atk_text_get_character_at_offset (ATK_TEXT(text->atko), (gint) offset); } @@ -329,13 +363,23 @@ impl_getTextBeforeOffset (PortableServer_Servant _servant, CORBA_long * endOffset, CORBA_Environment * ev) { - Text *text = TEXT (bonobo_object_from_servant (_servant)); + Text *text; gchar *txt; CORBA_char *rv; + gint intStartOffset, intEndOffset; + BonoboObject *obj; + + obj = (bonobo_object_from_servant (_servant)); + g_return_val_if_fail (IS_TEXT (obj), (CORBA_char *)""); + text = TEXT (obj); + g_return_val_if_fail (ATK_IS_TEXT (text->atko), (CORBA_char *)""); txt = atk_text_get_text_before_offset (ATK_TEXT(text->atko), (gint) offset, (AtkTextBoundary) type, - (gint *) startOffset, (gint *) endOffset); + &intStartOffset, &intEndOffset); + *startOffset = (CORBA_long) intStartOffset; + *endOffset = (CORBA_long) intEndOffset; + if (txt) { rv = CORBA_string_dup (txt); @@ -351,7 +395,14 @@ static CORBA_long impl__get_caretOffset (PortableServer_Servant _servant, CORBA_Environment * ev) { - Text *text = TEXT (bonobo_object_from_servant (_servant)); + Text *text; + BonoboObject *obj; + + obj = (bonobo_object_from_servant (_servant)); + g_return_val_if_fail (IS_TEXT (obj), (CORBA_long)-1); + text = TEXT (obj); + g_return_val_if_fail (ATK_IS_TEXT (text->atko), (CORBA_long)-1); + return (CORBA_long) atk_text_get_caret_offset (ATK_TEXT(text->atko)); } @@ -365,11 +416,16 @@ impl_getAttributes (PortableServer_Servant _servant, CORBA_long * endOffset, CORBA_Environment * ev) { - Text *text = TEXT (bonobo_object_from_servant (_servant)); - g_print ("getAttributes not implemented.\n"); -} + Text *text; + BonoboObject *obj; + obj = (bonobo_object_from_servant (_servant)); + g_return_val_if_fail (IS_TEXT (obj), (CORBA_char *)""); + text = TEXT (obj); + g_return_val_if_fail (ATK_IS_TEXT (text->atko), (CORBA_char *)""); + g_print ("getAttributes not yet implemented.\n"); +} static void impl_getCharacterExtents (PortableServer_Servant _servant, @@ -379,7 +435,14 @@ impl_getCharacterExtents (PortableServer_Servant _servant, const CORBA_short coordType, CORBA_Environment * ev) { - Text *text = TEXT (bonobo_object_from_servant (_servant)); + Text *text; + BonoboObject *obj; + + obj = (bonobo_object_from_servant (_servant)); + g_return_if_fail (IS_TEXT (obj)); + text = TEXT (obj); + g_return_if_fail (ATK_IS_TEXT (text->atko)); + atk_text_get_character_extents (ATK_TEXT(text->atko), (gint) offset, (gint *) x, (gint *) y, (gint *) width, (gint *) height, (AtkCoordType) coordType); @@ -391,7 +454,13 @@ static CORBA_long impl__get_characterCount (PortableServer_Servant _servant, CORBA_Environment * ev) { - Text *text = TEXT (bonobo_object_from_servant (_servant)); + Text *text; + BonoboObject *obj; + + obj = (bonobo_object_from_servant (_servant)); + g_return_val_if_fail (IS_TEXT (obj), (CORBA_long)0); + text = TEXT (obj); + return (CORBA_long) atk_text_get_character_count (ATK_TEXT(text->atko)); } @@ -404,7 +473,13 @@ impl_getOffsetAtPoint (PortableServer_Servant _servant, const CORBA_short coordType, CORBA_Environment * ev) { - Text *text = TEXT (bonobo_object_from_servant (_servant)); + Text *text; + BonoboObject *obj; + + obj = (bonobo_object_from_servant (_servant)); + g_return_val_if_fail (IS_TEXT (obj), (CORBA_long)-1); + text = TEXT (obj); + return (CORBA_long) atk_text_get_offset_at_point (ATK_TEXT(text->atko), (gint) x, (gint) y, (AtkCoordType) coordType); @@ -416,7 +491,13 @@ static CORBA_long impl_getNSelections (PortableServer_Servant _servant, CORBA_Environment * ev) { - Text *text = TEXT (bonobo_object_from_servant (_servant)); + Text *text; + BonoboObject *obj; + + obj = (bonobo_object_from_servant (_servant)); + g_return_val_if_fail (IS_TEXT (obj), (CORBA_long)0); + text = TEXT (obj); + return (CORBA_long) atk_text_get_n_selections (ATK_TEXT(text->atko)); } @@ -429,7 +510,13 @@ impl_getSelection (PortableServer_Servant _servant, CORBA_long * startOffset, CORBA_long * endOffset, CORBA_Environment * ev) { - Text *text = TEXT (bonobo_object_from_servant (_servant)); + Text *text; + BonoboObject *obj; + + obj = (bonobo_object_from_servant (_servant)); + g_return_if_fail (IS_TEXT (obj)); + text = TEXT (obj); + atk_text_get_selection (ATK_TEXT(text->atko), (gint) selectionNum, (gint *) startOffset, (gint *) endOffset); } @@ -442,7 +529,13 @@ impl_addSelection (PortableServer_Servant _servant, const CORBA_long endOffset, CORBA_Environment * ev) { - Text *text = TEXT (bonobo_object_from_servant (_servant)); + Text *text; + BonoboObject *obj; + + obj = (bonobo_object_from_servant (_servant)); + g_return_val_if_fail (IS_TEXT (obj), (CORBA_boolean)FALSE); + text = TEXT (obj); + return (CORBA_boolean) atk_text_add_selection (ATK_TEXT(text->atko), (gint) startOffset, (gint) endOffset); @@ -455,7 +548,13 @@ impl_removeSelection (PortableServer_Servant _servant, const CORBA_long selectionNum, CORBA_Environment * ev) { - Text *text = TEXT (bonobo_object_from_servant (_servant)); + Text *text; + BonoboObject *obj; + + obj = (bonobo_object_from_servant (_servant)); + g_return_val_if_fail (IS_TEXT (obj), (CORBA_boolean)FALSE); + text = TEXT (obj); + return (CORBA_boolean) atk_text_remove_selection (ATK_TEXT(text->atko), (gint) selectionNum); } @@ -469,7 +568,13 @@ impl_setSelection (PortableServer_Servant _servant, const CORBA_long endOffset, CORBA_Environment * ev) { - Text *text = TEXT (bonobo_object_from_servant (_servant)); + Text *text; + BonoboObject *obj; + + obj = (bonobo_object_from_servant (_servant)); + g_return_val_if_fail (IS_TEXT (obj), (CORBA_boolean)FALSE); + text = TEXT (obj); + return (CORBA_boolean) atk_text_set_selection (ATK_TEXT(text->atko), (gint) selectionNum, (gint) startOffset, (gint) endOffset); @@ -482,7 +587,13 @@ impl_setCaretOffset (PortableServer_Servant _servant, const CORBA_long value, CORBA_Environment * ev) { - Text *text = TEXT (bonobo_object_from_servant (_servant)); + Text *text; + BonoboObject *obj; + + obj = (bonobo_object_from_servant (_servant)); + g_return_val_if_fail (IS_TEXT (obj), (CORBA_boolean)FALSE); + text = TEXT (obj); + return (CORBA_boolean) atk_text_set_caret_offset (ATK_TEXT(text->atko), (gint) value); } @@ -494,6 +605,13 @@ impl_getRowColAtOffset (PortableServer_Servant _servant, const CORBA_long offset, CORBA_long * row, CORBA_long * column, CORBA_Environment * ev) { - Text *text = TEXT (bonobo_object_from_servant (_servant)); + Text *text; + BonoboObject *obj; + + obj = (bonobo_object_from_servant (_servant)); + g_return_if_fail (IS_TEXT (obj)); + text = TEXT (obj); + + g_print ("getRowColAtOffset not yet implemented\n"); }