KOffice – TDE office suite
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

222 lines
5.1KB

  1. /* This file is part of the KDE project
  2. Copyright 2004 Ariya Hidayat <ariya@kde.org>
  3. Copyright 2003 Norbert Andres <nandres@web.de>
  4. Copyright 2002 Laurent Montel <montel@kde.org>
  5. Copyright 2002 Simon Hausmann <hausmann@kde.org>
  6. Copyright 2001-2002 Philipp Mueller <philipp.mueller@gmx.de>
  7. Copyright 2000 Stephan Kulow <coolo@kde.org>
  8. Copyright 1999-2000 David Faure <faure@kde.org>
  9. Copyright 1999 Torben Weis <weis@kde.org>
  10. This library is free software; you can redistribute it and/or
  11. modify it under the terms of the GNU Library General Public
  12. License as published by the Free Software Foundation; either
  13. version 2 of the License, or (at your option) any later version.
  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. Library General Public License for more details.
  18. You should have received a copy of the GNU Library General Public License
  19. along with this library; see the file COPYING.LIB. If not, write to
  20. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  21. * Boston, MA 02110-1301, USA.
  22. */
  23. #include "KSpreadDocIface.h"
  24. #include <KoDocumentIface.h>
  25. #include "kspread_doc.h"
  26. #include "kspread_map.h"
  27. #include <tdeapplication.h>
  28. #include <dcopclient.h>
  29. #include <tqcolor.h>
  30. #include <kdebug.h>
  31. using namespace KSpread;
  32. DocIface::DocIface( Doc* _doc )
  33. : KoDocumentIface( _doc )
  34. {
  35. doc=_doc;
  36. }
  37. DCOPRef DocIface::map()
  38. {
  39. return DCOPRef( kapp->dcopClient()->appId(),
  40. doc->map()->dcopObject()->objId() );
  41. }
  42. void DocIface::changeDefaultGridPenColor( const TQColor &_col)
  43. {
  44. doc->setGridColor(_col);
  45. }
  46. TQColor DocIface::pageBorderColor() const
  47. {
  48. return doc->pageBorderColor();
  49. }
  50. bool DocIface::showFormulaBar()const
  51. {
  52. return doc->getShowFormulaBar();
  53. }
  54. bool DocIface::showStatusBar()const
  55. {
  56. return doc->getShowStatusBar();
  57. }
  58. bool DocIface::showTabBar()const
  59. {
  60. return doc->getShowTabBar();
  61. }
  62. void DocIface::setShowVerticalScrollBar(bool _show)
  63. {
  64. doc->setShowVerticalScrollBar(_show);
  65. doc->refreshInterface();
  66. }
  67. void DocIface::setShowHorizontalScrollBar(bool _show)
  68. {
  69. doc->setShowHorizontalScrollBar(_show);
  70. doc->refreshInterface();
  71. }
  72. void DocIface::setShowColHeader(bool _show)
  73. {
  74. doc->setShowColHeader(_show);
  75. doc->refreshInterface();
  76. }
  77. void DocIface::setShowRowHeader(bool _show)
  78. {
  79. doc->setShowRowHeader(_show);
  80. doc->refreshInterface();
  81. }
  82. void DocIface::setShowTabBar(bool _show)
  83. {
  84. doc->setShowTabBar(_show);
  85. doc->refreshInterface();
  86. }
  87. void DocIface::changePageBorderColor( const TQColor & _color)
  88. {
  89. doc->changePageBorderColor( _color);
  90. doc->refreshInterface();
  91. }
  92. void DocIface::addIgnoreWordAll( const TQString &word)
  93. {
  94. doc->addIgnoreWordAll( word );
  95. }
  96. void DocIface::clearIgnoreWordAll( )
  97. {
  98. doc->clearIgnoreWordAll();
  99. }
  100. TQStringList DocIface::spellListIgnoreAll() const
  101. {
  102. return doc->spellListIgnoreAll();
  103. }
  104. void DocIface::addStringCompletion(const TQString & stringCompletion)
  105. {
  106. doc->addStringCompletion( stringCompletion );
  107. }
  108. int DocIface::zoom() const
  109. {
  110. return doc->zoom();
  111. }
  112. TQString DocIface::moveToValue()const
  113. {
  114. switch(doc->getMoveToValue())
  115. {
  116. case Bottom:
  117. return TQString("bottom");
  118. break;
  119. case Left:
  120. return TQString("left");
  121. break;
  122. case Top:
  123. return TQString("top");
  124. break;
  125. case Right:
  126. return TQString("right");
  127. break;
  128. case BottomFirst:
  129. return TQString("bottomFirst");
  130. break;
  131. }
  132. return TQString();
  133. }
  134. void DocIface::setMoveToValue(const TQString & move)
  135. {
  136. if ( move.lower()=="bottom" )
  137. doc->setMoveToValue(Bottom);
  138. else if ( move.lower()=="top" )
  139. doc->setMoveToValue(Top);
  140. else if ( move.lower()=="left" )
  141. doc->setMoveToValue(Left);
  142. else if ( move.lower()=="right" )
  143. doc->setMoveToValue(Right);
  144. else if ( move.lower()=="bottomfirst" )
  145. doc->setMoveToValue(BottomFirst);
  146. }
  147. void DocIface::setTypeOfCalc( const TQString & calc )
  148. {
  149. if ( calc.lower()=="sum")
  150. doc->setTypeOfCalc(SumOfNumber );
  151. else if ( calc.lower()=="min")
  152. doc->setTypeOfCalc( Min );
  153. else if ( calc.lower()=="max")
  154. doc->setTypeOfCalc(Max );
  155. else if ( calc.lower()=="average")
  156. doc->setTypeOfCalc(Average );
  157. else if ( calc.lower()=="count")
  158. doc->setTypeOfCalc(Count );
  159. else if ( calc.lower()=="none")
  160. doc->setTypeOfCalc(NoneCalc );
  161. else
  162. kdDebug()<<"Error in setTypeOfCalc( const TQString & calc ) :"<<calc<<endl;
  163. doc->refreshInterface();
  164. }
  165. TQString DocIface::typeOfCalc() const
  166. {
  167. switch( doc->getTypeOfCalc() )
  168. {
  169. case SumOfNumber:
  170. return TQString("sum");
  171. break;
  172. case Min:
  173. return TQString("min");
  174. break;
  175. case Max:
  176. return TQString("max");
  177. break;
  178. case Average:
  179. return TQString("average");
  180. break;
  181. case Count:
  182. return TQString("count");
  183. break;
  184. case NoneCalc:
  185. default:
  186. return TQString("none");
  187. break;
  188. }
  189. }