PageRenderTime 29ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/llui/lltextutil.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 81 lines | 22 code | 12 blank | 47 comment | 0 complexity | 06b22ee0d4d1868ffbd9385f36fb6249 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file lltextutil.h
  3. * @brief Misc text-related auxiliary methods
  4. *
  5. * $LicenseInfo:firstyear=2009&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_LLTEXTUTIL_H
  27. #define LL_LLTEXTUTIL_H
  28. #include "llstyle.h"
  29. class LLTextBox;
  30. class LLUrlMatch;
  31. class LLTextBase;
  32. namespace LLTextUtil
  33. {
  34. /**
  35. * Set value for text box, highlighting substring hl_uc.
  36. *
  37. * Used to highlight filter matches.
  38. *
  39. * @param txtbox Text box to set value for
  40. * @param normal_style Style to use for non-highlighted text
  41. * @param text Text to set
  42. * @param hl Upper-cased string to highlight
  43. */
  44. void textboxSetHighlightedVal(
  45. LLTextBox *txtbox,
  46. const LLStyle::Params& normal_style,
  47. const std::string& text,
  48. const std::string& hl);
  49. /**
  50. * Formats passed phone number to be more human readable.
  51. *
  52. * It just divides the number on parts by two digits from right to left. The first left part
  53. * can have 2 or 3 digits, i.e. +44-33-33-44-55-66 or 12-34-56-78-90. Separator is set in
  54. * application settings (AvalinePhoneSeparator)
  55. *
  56. * @param[in] phone_str string with original phone number
  57. * @return reference to string with formatted phone number
  58. */
  59. const std::string& formatPhoneNumber(const std::string& phone_str);
  60. bool processUrlMatch(LLUrlMatch* match,LLTextBase* text_base);
  61. class TextHelpers
  62. {
  63. //we need this special callback since we need to create LLAvataIconCtrls while parsing
  64. //avatar/group url but can't create LLAvataIconCtrl from LLUI
  65. public:
  66. static boost::function<bool(LLUrlMatch*,LLTextBase*)> iconCallbackCreationFunction;
  67. };
  68. }
  69. #endif // LL_LLTEXTUTIL_H