1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef SC_NAVIPI_HXX 25 #define SC_NAVIPI_HXX 26 27 #include <vector> 28 #include <vcl/toolbox.hxx> 29 #include <vcl/field.hxx> 30 #include <vcl/lstbox.hxx> 31 #include <svtools/stdctrl.hxx> 32 #include <svl/poolitem.hxx> 33 #include <svl/lstner.hxx> 34 #include <sfx2/childwin.hxx> 35 #include "content.hxx" 36 #include <svtools/svmedit.hxx> 37 38 39 class ScTabViewShell; 40 class ScViewData; 41 class ScArea; 42 class ScScenarioWindow; 43 class ScNavigatorControllerItem; 44 class ScNavigatorDialogWrapper; 45 class ScNavigatorDlg; 46 class ScNavigatorSettings; 47 class ScRange; 48 49 //======================================================================== 50 51 #define SC_DROPMODE_URL 0 52 #define SC_DROPMODE_LINK 1 53 #define SC_DROPMODE_COPY 2 54 55 enum NavListMode { NAV_LMODE_NONE = 0x4000, 56 NAV_LMODE_AREAS = 0x2000, 57 NAV_LMODE_DBAREAS = 0x1000, 58 NAV_LMODE_DOCS = 0x800, 59 NAV_LMODE_SCENARIOS = 0x400 }; 60 61 //======================================================================== 62 // class ScScenarioListBox ----------------------------------------------- 63 //======================================================================== 64 65 class ScScenarioListBox : public ListBox 66 { 67 public: 68 explicit ScScenarioListBox( ScScenarioWindow& rParent ); 69 virtual ~ScScenarioListBox(); 70 71 void UpdateEntries( List* pNewEntryList ); 72 73 protected: 74 virtual void Select(); 75 virtual void DoubleClick(); 76 virtual long Notify( NotifyEvent& rNEvt ); 77 78 private: 79 struct ScenarioEntry 80 { 81 String maName; 82 String maComment; 83 bool mbProtected; 84 85 inline explicit ScenarioEntry() : mbProtected( false ) {} 86 }; 87 typedef ::std::vector< ScenarioEntry > ScenarioList; 88 89 private: 90 const ScenarioEntry* GetSelectedEntry() const; 91 92 void ExecuteScenarioSlot( sal_uInt16 nSlotId ); 93 void SelectScenario(); 94 void EditScenario(); 95 void DeleteScenario( bool bQueryBox ); 96 97 private: 98 ScScenarioWindow& mrParent; 99 ScenarioList maEntries; 100 }; 101 102 //======================================================================== 103 // class ScScenarioWindow ------------------------------------------------ 104 //======================================================================== 105 class ScScenarioWindow : public Window 106 { 107 public: 108 ScScenarioWindow( Window* pParent,const String& aQH_List,const String& aQH_Comment); 109 ~ScScenarioWindow(); 110 111 void NotifyState( const SfxPoolItem* pState ); 112 void SetComment( const String& rComment ) 113 { aEdComment.SetText( rComment ); } 114 115 void SetSizePixel( const Size& rNewSize ); 116 117 protected: 118 119 virtual void Paint( const Rectangle& rRec ); 120 121 private: 122 ScScenarioListBox aLbScenario; 123 MultiLineEdit aEdComment; 124 }; 125 126 //================================================================== 127 // class ColumnEdit 128 //================================================================== 129 class ColumnEdit : public SpinField 130 { 131 public: 132 ColumnEdit( ScNavigatorDlg* pParent, const ResId& rResId ); 133 ~ColumnEdit(); 134 135 SCCOL GetCol() { return nCol; } 136 void SetCol( SCCOL nColNo ); 137 138 protected: 139 virtual long Notify( NotifyEvent& rNEvt ); 140 virtual void LoseFocus(); 141 virtual void Up(); 142 virtual void Down(); 143 virtual void First(); 144 virtual void Last(); 145 146 private: 147 ScNavigatorDlg& rDlg; 148 SCCOL nCol; 149 sal_uInt16 nKeyGroup; 150 151 void EvalText (); 152 void ExecuteCol (); 153 SCCOL AlphaToNum ( String& rStr ); 154 SCCOL NumStrToAlpha ( String& rStr ); 155 SCCOL NumToAlpha ( SCCOL nColNo, String& rStr ); 156 }; 157 158 159 //================================================================== 160 // class RowEdit 161 //================================================================== 162 class RowEdit : public NumericField 163 { 164 public: 165 RowEdit( ScNavigatorDlg* pParent, const ResId& rResId ); 166 ~RowEdit(); 167 168 SCROW GetRow() { return (SCROW)GetValue(); } 169 void SetRow( SCROW nRow ){ SetValue( nRow ); } 170 171 protected: 172 virtual long Notify( NotifyEvent& rNEvt ); 173 virtual void LoseFocus(); 174 175 private: 176 ScNavigatorDlg& rDlg; 177 178 void ExecuteRow(); 179 }; 180 181 182 //================================================================== 183 // class ScDocListBox 184 //================================================================== 185 class ScDocListBox : public ListBox 186 { 187 public: 188 ScDocListBox( ScNavigatorDlg* pParent, const ResId& rResId ); 189 ~ScDocListBox(); 190 191 protected: 192 virtual void Select(); 193 194 private: 195 ScNavigatorDlg& rDlg; 196 }; 197 198 199 //================================================================== 200 // class CommandToolBox 201 //================================================================== 202 class CommandToolBox : public ToolBox 203 { 204 public: 205 CommandToolBox( ScNavigatorDlg* pParent, const ResId& rResId ); 206 ~CommandToolBox(); 207 208 void Select( sal_uInt16 nId ); 209 void UpdateButtons(); 210 void InitImageList(); 211 212 virtual void DataChanged( const DataChangedEvent& rDCEvt ); 213 214 DECL_LINK( ToolBoxDropdownClickHdl, ToolBox* ); 215 216 protected: 217 virtual void Select(); 218 virtual void Click(); 219 220 private: 221 ScNavigatorDlg& rDlg; 222 }; 223 224 //================================================================== 225 // class ScNavigatorDlg 226 //================================================================== 227 228 class ScNavigatorDlg : public Window, public SfxListener 229 { 230 friend class ScNavigatorControllerItem; 231 friend class ScNavigatorDialogWrapper; 232 friend class ColumnEdit; 233 friend class RowEdit; 234 friend class ScDocListBox; 235 friend class CommandToolBox; 236 friend class ScContentTree; 237 238 private: 239 SfxBindings& rBindings; // must be first member 240 241 ImageList aCmdImageList; // must be before aTbxCmd 242 ImageList aCmdImageListH; 243 FixedInfo aFtCol; 244 ColumnEdit aEdCol; 245 FixedInfo aFtRow; 246 RowEdit aEdRow; 247 CommandToolBox aTbxCmd; 248 ScContentTree aLbEntries; 249 ScScenarioWindow aWndScenarios; 250 ScDocListBox aLbDocuments; 251 252 Timer aContentTimer; 253 254 String aTitleBase; 255 String aStrDragMode; 256 String aStrDisplay; 257 String aStrActive; 258 String aStrNotActive; 259 String aStrHidden; 260 String aStrActiveWin; 261 262 SfxChildWindowContext* pContextWin; 263 Size aInitSize; 264 ScArea* pMarkArea; 265 ScViewData* pViewData; 266 267 long nBorderOffset; 268 long nListModeHeight; 269 long nInitListHeight; 270 NavListMode eListMode; 271 sal_uInt16 nDropMode; 272 SCCOL nCurCol; 273 SCROW nCurRow; 274 SCTAB nCurTab; 275 sal_Bool bFirstBig; 276 277 ScNavigatorControllerItem** ppBoundItems; 278 279 DECL_LINK( TimeHdl, Timer* ); 280 281 void DoResize(); 282 283 SfxBindings& GetBindings() 284 { return rBindings; } 285 286 void SetCurrentCell( SCCOL nCol, SCROW Row ); 287 void SetCurrentCellStr( const String rName ); 288 void SetCurrentTable( SCTAB nTab ); 289 void SetCurrentTableStr( const String rName ); 290 void SetCurrentObject( const String rName ); 291 void SetCurrentDoc( const String& rDocName ); 292 293 ScTabViewShell* GetTabViewShell() const; 294 ScNavigatorSettings* GetNavigatorSettings(); 295 sal_Bool GetViewData(); 296 297 void UpdateColumn ( const SCCOL* pCol = NULL ); 298 void UpdateRow ( const SCROW* pRow = NULL ); 299 void UpdateTable ( const SCTAB* pTab = NULL ); 300 void UpdateAll (); 301 302 void GetDocNames(const String* pSelEntry = NULL); 303 304 void SetListMode ( NavListMode eMode, sal_Bool bSetSize = sal_True ); 305 void ShowList ( sal_Bool bShow, sal_Bool bSetSize ); 306 void ShowScenarios ( sal_Bool bShow, sal_Bool bSetSize ); 307 308 void SetDropMode(sal_uInt16 nNew); 309 sal_uInt16 GetDropMode() const { return nDropMode; } 310 311 const String& GetStrDragMode() const { return aStrDragMode; } 312 const String& GetStrDisplay() const { return aStrDisplay; } 313 314 void CheckDataArea (); 315 void MarkDataArea (); 316 void UnmarkDataArea (); 317 void StartOfDataArea (); 318 void EndOfDataArea (); 319 320 static void ReleaseFocus(); 321 322 protected: 323 virtual void Resize(); 324 virtual void Paint( const Rectangle& rRec ); 325 virtual void Resizing( Size& rSize ); 326 327 public: 328 ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, Window* pParent ); 329 ~ScNavigatorDlg(); 330 331 using Window::Notify; 332 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 333 334 void CursorPosChanged(); 335 336 virtual SfxChildAlignment 337 CheckAlignment(SfxChildAlignment,SfxChildAlignment); 338 virtual void DataChanged( const DataChangedEvent& rDCEvt ); 339 }; 340 341 //================================================================== 342 343 class ScNavigatorDialogWrapper: public SfxChildWindowContext 344 { 345 public: 346 ScNavigatorDialogWrapper( Window* pParent, 347 sal_uInt16 nId, 348 SfxBindings* pBindings, 349 SfxChildWinInfo* pInfo ); 350 351 SFX_DECL_CHILDWINDOWCONTEXT(ScNavigatorDialogWrapper) 352 353 virtual void Resizing( Size& rSize ); 354 355 private: 356 ScNavigatorDlg* pNavigator; 357 }; 358 359 360 361 #endif // SC_NAVIPI_HXX 362 363