/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */

#ifndef __com_sun_star_smarttags_XSmartTagAction_idl__
#define __com_sun_star_smarttags_XSmartTagAction_idl__

#include <com/sun/star/container/XStringKeyMap.idl>
#include <com/sun/star/lang/XInitialization.idl>
#include <com/sun/star/lang/Locale.idl>
#include <com/sun/star/text/XTextRange.idl>
#include <com/sun/star/frame/XController.idl>
#include <com/sun/star/lang/IndexOutOfBoundsException.idl>
#include <com/sun/star/lang/IllegalArgumentException.idl>


module com {  module sun {  module star {  module smarttags {


/** provides access to smart tag actions.

    @since OOo 2.3
 */

interface XSmartTagAction: com::sun::star::lang::XInitialization
{
    /** obtains a name that describes this action component.

        @param aLocale
                Is used for localization of the name.

        @return
                the name describing the action component.
    */
    string getName( [in] ::com::sun::star::lang::Locale aLocale );


    /** obtains a detailed description of this action component.

        @param aLocale
                Is used for localization of the description.

        @return
                the description of the action component.
    */
    string getDescription( [in] ::com::sun::star::lang::Locale aLocale );


    /** the number of smart tag types supported by this action
        component.
    */
    [attribute, readonly] long SmartTagCount;


    /** obtains the name of one specific smart tag type supported by
        this action component.

        @param nSmartTagIndex
                Index of the wanted smart tag type. Value needs to be
                between 0 and the number of smarttags available
                (exclusively).

        @return
                an unique name of the smart tag type. Smart tag  type
                names are always in the format of namespaceURI#tagname.

        @throws com::sun::star::lang::IndexOutOfBoundsException
                if nSmartTagIndex is greater than SmartTagCount.
    */
    string getSmartTagName( [in] long nSmartTagIndex)
        raises( com::sun::star::lang::IndexOutOfBoundsException );


    /** obtains the caption of the smart tag type for using in user
        interfaces.

        @param nSmartTagIndex
                Index of the wanted smart tag type. Value needs to be
                between 0 and the number of smarttags available
                (exclusively).

        @param aLocale
                Is used for localization of the caption.

        @return
                the caption associated with the smart tag type.

        @throws com::sun::star::lang::IndexOutOfBoundsException
                if nSmartTagIndex is greater than SmartTagCount
     */
    string getSmartTagCaption( [in] long nSmartTagIndex,
                               [in] ::com::sun::star::lang::Locale aLocale)
        raises( com::sun::star::lang::IndexOutOfBoundsException );


    /** obtains the number of actions provided for a specify smart tag
        type.

        @param aSmartTagName
                Name of the wanted smart tag type. This is one of the
                names obtained by getSmartTagName()

        @param xController
                The current controller of the document.

        @return
                the number of actions available for the given smart tag
                type.
    */
    long getActionCount( [in] string aSmartTagName,
                         [in] com::sun::star::frame::XController xController,
                         [in] com::sun::star::container::XStringKeyMap xProperties);

    /** obtains a unique integer identifier for an action.

        @param aSmartTagName
                Name of the wanted smart tag type. This is one of the
                names obtained by getSmartTagName()

        @param nActionIndex
                The index of the action for the given smart tag type.

        @param xController
                The current controller of the document.

        @return
                the unique integer identifier for the requested action.

        @throws com::sun::star::lang::IllegalArgumentException
                if the specified nActionIndex is greater than the number
                of available actions for the specified smart tag type.
    */
    long getActionID( [in] string aSmartTagName, [in] long nActionIndex,
                      [in] com::sun::star::frame::XController xController )
        raises( com::sun::star::lang::IllegalArgumentException );


    /** obtains a caption for a specified action for use in user
        interfaces.

        @param nActionID
                The identifier of the requested action.

        @param aApplicationName
                A string containing the name of the calling application.

        @param aLocale
                Is used for localization of the caption.

        @param xProperties
                Contains additional smart tag properties collected by
                the smart tag recognizer.

        @param aText
                The calling application can pass the text of the smart
                tag to the action component.

        @param aXML
                A string that is a XML representation of the smart tag.

        @param xController
                The current controller of the document.

        @param xTarget
                A text range representing the smart tag in the document.

        @return
                the caption of the requested action.

        @throws com::sun::star::lang::IllegalArgumentException
                if the ActionID is not recognized.
    */
    string getActionCaptionFromID( [in] long nActionID,
                                   [in] string aApplicationName,
                                   [in] ::com::sun::star::lang::Locale aLocale,
                                   [in] com::sun::star::container::XStringKeyMap xProperties,
                                   [in] string aText,
                                   [in] string aXML,
                                   [in] com::sun::star::frame::XController xController,
                                   [in] com::sun::star::text::XTextRange xTarget )
        raises( com::sun::star::lang::IllegalArgumentException );


    /** obtains a language independent name of an action.

        @param nActionID
                The identifier of the requested action.

        @param xController
                The current controller of the document.

        @return
                the language independent name of the specified action.

        @throws com::sun::star::lang::IllegalArgumentException
                if the ActionID is not recognized.
    */
    string getActionNameFromID( [in] long nActionID,
                                [in] com::sun::star::frame::XController xController)
        raises( com::sun::star::lang::IllegalArgumentException );


    /** invokes an action.

        @param nActionID
                The identifier of the requested action.

        @param aApplicationName
                A string containing the name of the calling application.

        @param xController
                The current controller of the document.

        @param xTarget
                A text range representing the smart tag in the document.

        @param xProperties
                Contains the smart tag properties collected by the smart
                tag recognizer.

        @param aText
                The calling application can pass the text of the smart
                tag to the action component.

        @param aXML
                A string that is a XML representation of the smart tag.

        @param aLocale
                Is used for localization of the action.

        @throws com::sun::star::lang::IllegalArgumentException
                if the ActionID is not recognized.
    */
    void invokeAction( [in] long nActionID,
                       [in] string aApplicationName,
                       [in] com::sun::star::frame::XController xController,
                       [in] com::sun::star::text::XTextRange xTarget,
                       [in] com::sun::star::container::XStringKeyMap xProperties,
                       [in] string aText,
                       [in] string aXML,
                       [in] ::com::sun::star::lang::Locale aLocale )
        raises( com::sun::star::lang::IllegalArgumentException );


    /** determines whether a caption is dynamic.

        @param nActionID
                The identifier of the requested action.

        @param aApplicationName
                A string containing the name of the calling application.

        @param xController
                The current controller of the document.

        @param aLocale
                Is used for localization.

        @return
                a boolean indicating whether the caption is dynamic.

        @throws com::sun::star::lang::IllegalArgumentException
                if the ActionID is not recognized.
    */
    boolean isCaptionDynamic( [in] long nActionID,
                              [in] string aApplicationName,
                              [in] com::sun::star::frame::XController xController,
                              [in] ::com::sun::star::lang::Locale aLocale )
        raises( com::sun::star::lang::IllegalArgumentException );


    /** determines whether the smart tag indicator should be visible.

        @param nActionID
                The identifier of the requested action.

        @param aApplicationName
                A string containing the name of the calling application.

        @param xController
                The current controller of the document.

        @param aLocale
                Is used for localization.

        @return
                a boolean indicating whether the smart tag indicator
                should be visible.

        @throws com::sun::star::lang::IllegalArgumentException
                if the ActionID is not recognized.
    */
    boolean isShowSmartTagIndicator( [in] long nActionID,
                                     [in] string aApplicationName,
                                     [in] com::sun::star::frame::XController xController,
                                     [in] ::com::sun::star::lang::Locale aLocale )
        raises( com::sun::star::lang::IllegalArgumentException );
};

}; }; }; };

#endif

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
