1 // Copyright 2010-2018, Google Inc. 2 // All rights reserved. 3 // 4 // Redistribution and use in source and binary forms, with or without 5 // modification, are permitted provided that the following conditions are 6 // met: 7 // 8 // * Redistributions of source code must retain the above copyright 9 // notice, this list of conditions and the following disclaimer. 10 // * Redistributions in binary form must reproduce the above 11 // copyright notice, this list of conditions and the following disclaimer 12 // in the documentation and/or other materials provided with the 13 // distribution. 14 // * Neither the name of Google Inc. nor the names of its 15 // contributors may be used to endorse or promote products derived from 16 // this software without specific prior written permission. 17 // 18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 30 @class NSURL; 31 32 #include "protocol/commands.pb.h" 33 34 @interface GoogleJapaneseInputController () 35 // Updates |composedString_| from the result of a key event and put 36 // the updated composed string to the client application. 37 - (void)updateComposedString:(const mozc::commands::Preedit *)preedit; 38 39 // Updates |candidates_| from the result of a key event. 40 - (void)updateCandidates:(const mozc::commands::Output *)output; 41 42 // Clear all candidate data in |candidates_|. 43 - (void)clearCandidates; 44 45 // Open link specified by the URL. 46 - (void)openLink:(NSURL *)url; 47 48 49 // Auxiliary methods for switchMode: below. 50 - (void)switchModeToDirect:(id)sender; 51 - (void)switchModeInternal:(mozc::commands::CompositionMode)new_mode; 52 53 // Switches to a new mode and sync the current mode with the converter. 54 - (void)switchMode:(mozc::commands::CompositionMode)new_mode 55 client:(id)sender; 56 57 // Switch the mode icon in the task bar according to |mode_|. 58 - (void)switchDisplayMode; 59 60 // Commit the specified text to the current client. 61 - (void)commitText:(const char *)text client:(id)sender; 62 63 // Conduct the reconvert event. It could have several tricks such 64 // like invoking UNDO instead if nothing is selected. |sender| has to 65 // be the proxy object to the client application, which might not be 66 // same as the sender of the click event itself when the user clicks 67 // the menu item. 68 - (void)invokeReconvert:(const mozc::commands::SessionCommand *)command 69 client:(id)sender; 70 71 // Conduct the undo command. 72 - (void)invokeUndo:(id)sender; 73 74 // Process output fields such as preedit, output text, candidates, and 75 // modes and calls methods above. 76 - (void)processOutput:(const mozc::commands::Output *)output client:(id)sender; 77 78 // Obtain the current configuration from the server and update 79 // client-specific configurations. 80 - (void)handleConfig; 81 82 // Set up the client capability 83 - (void)setupCapability; 84 // Set up the cilent bundle for the sender. 85 - (void)setupClientBundle:(id)sender; 86 87 // Launch the word register tool with the current selection range. 88 - (void)launchWordRegisterTool:(id)client; 89 90 // Fills the surrounding context (preceding_text and following_text). 91 // Returns false if fails to get the surrounding context from the client. 92 - (BOOL)fillSurroundingContext:(mozc::commands::Context *)context 93 client:(id<IMKTextInput>)client; 94 95 // They are externally accessible to achieve tests. 96 @property(readwrite, assign, nonatomic) 97 mozc::client::ClientInterface *mozcClient; 98 @property(readwrite, retain, nonatomic) KeyCodeMap *keyCodeMap; 99 @property(readwrite, assign, nonatomic) 100 mozc::renderer::RendererInterface *renderer; 101 @property(readonly) mozc::config::Config::YenSignCharacter yenSignCharacter; 102 @property(readwrite, assign) mozc::commands::CompositionMode mode; 103 @property(readonly) mozc::commands::RendererCommand *rendererCommand; 104 @property(readwrite, assign) NSRange replacementRange; 105 @property(readwrite, retain) id imkClientForTest; 106 @end 107