interfaces
selectioninterface.cpp
Go to the documentation of this file.00001 #include "selectioninterface.h" 00002 #include "selectiondcopinterface.h" 00003 #include "document.h" 00004 #include "view.h" 00005 00006 using namespace KTextEditor; 00007 00008 namespace KTextEditor 00009 { 00010 class PrivateSelectionInterface 00011 { 00012 public: 00013 PrivateSelectionInterface() 00014 { 00015 interface = 0; 00016 } 00017 ~PrivateSelectionInterface(){} 00018 // Data Members 00019 SelectionDCOPInterface *interface; 00020 }; 00021 00022 } 00023 00024 unsigned int SelectionInterface::globalSelectionInterfaceNumber = 0; 00025 00026 SelectionInterface::SelectionInterface() 00027 { 00028 d = new PrivateSelectionInterface(); 00029 globalSelectionInterfaceNumber++; 00030 mySelectionInterfaceNumber = globalSelectionInterfaceNumber; 00031 QString name = "SelectionInterface#" + QString::number(mySelectionInterfaceNumber); 00032 d->interface = new SelectionDCOPInterface(this, name.latin1()); 00033 } 00034 SelectionInterface::~SelectionInterface() 00035 { 00036 delete d->interface; 00037 delete d; 00038 } 00039 00040 unsigned int SelectionInterface::selectionInterfaceNumber () const 00041 { 00042 return mySelectionInterfaceNumber; 00043 } 00044 00045 void SelectionInterface::setSelectionInterfaceDCOPSuffix (const QCString &suffix) 00046 { 00047 d->interface->setObjId ("SelectionInterface#"+suffix); 00048 } 00049 00050 SelectionInterface *KTextEditor::selectionInterface (Document *doc) 00051 { 00052 if (!doc) 00053 return 0; 00054 00055 return static_cast<SelectionInterface*>(doc->qt_cast("KTextEditor::SelectionInterface")); 00056 } 00057 00058 SelectionInterface *KTextEditor::selectionInterface (View *view) 00059 { 00060 if (!view) 00061 return 0; 00062 00063 return static_cast<SelectionInterface*>(view->qt_cast("KTextEditor::SelectionInterface")); 00064 } 00065