diff options
Diffstat (limited to 'dbaccess/source/ui/tabledesign')
17 files changed, 153 insertions, 480 deletions
diff --git a/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx b/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx index cbbf61bf0a21..1450bd743001 100644 --- a/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx +++ b/dbaccess/source/ui/tabledesign/FieldDescGenWin.cxx @@ -26,13 +26,9 @@ #include "TEditControl.hxx" using namespace dbaui; -//================================================================== // class OFieldDescGenWin -//================================================================== DBG_NAME(OFieldDescGenWin) -//================================================================== -//------------------------------------------------------------------------------ OFieldDescGenWin::OFieldDescGenWin( Window* pParent, OTableDesignHelpBar* pHelp ) : TabPage( pParent, WB_3DLOOK | WB_DIALOGCONTROL ) { @@ -41,55 +37,54 @@ OFieldDescGenWin::OFieldDescGenWin( Window* pParent, OTableDesignHelpBar* pHelp m_pFieldControl->SetHelpId(HID_TAB_DESIGN_FIELDCONTROL); m_pFieldControl->Show(); } -//------------------------------------------------------------------------------ + OFieldDescGenWin::~OFieldDescGenWin() { DBG_DTOR(OFieldDescGenWin,NULL); ::std::auto_ptr<Window> aTemp(m_pFieldControl); m_pFieldControl = NULL; } -//------------------------------------------------------------------------------ + void OFieldDescGenWin::Init() { OSL_ENSURE(GetEditorCtrl() != NULL, "OFieldDescGenWin::Init : have no editor control !"); m_pFieldControl->Init(); } -//------------------------------------------------------------------------------ + void OFieldDescGenWin::Resize() { m_pFieldControl->SetPosSizePixel(Point(0,0),GetSizePixel()); m_pFieldControl->Resize(); } -//------------------------------------------------------------------------------ + void OFieldDescGenWin::SetReadOnly( sal_Bool bReadOnly ) { DBG_CHKTHIS(OFieldDescGenWin,NULL); m_pFieldControl->SetReadOnly(bReadOnly); } -//------------------------------------------------------------------------------ + String OFieldDescGenWin::GetControlText( sal_uInt16 nControlId ) { DBG_CHKTHIS(OFieldDescGenWin,NULL); return m_pFieldControl->GetControlText(nControlId); } -//------------------------------------------------------------------------------ + void OFieldDescGenWin::SetControlText( sal_uInt16 nControlId, const String& rText ) { DBG_CHKTHIS(OFieldDescGenWin,NULL); - ////////////////////////////////////////////////////////////////////// // Texte der Controls setzen m_pFieldControl->SetControlText(nControlId,rText); } -//------------------------------------------------------------------------------ + void OFieldDescGenWin::DisplayData( OFieldDescription* pFieldDescr ) { DBG_CHKTHIS(OFieldDescGenWin,NULL); m_pFieldControl->DisplayData(pFieldDescr); } -//------------------------------------------------------------------------------ + #if OSL_DEBUG_LEVEL > 0 OTableEditorCtrl* OFieldDescGenWin::GetEditorCtrl() { @@ -97,75 +92,72 @@ OTableEditorCtrl* OFieldDescGenWin::GetEditorCtrl() OTableDesignView* pDesignWin = static_cast<OTableDesignView*>(GetParent()->GetParent()->GetParent()); return pDesignWin->GetEditorCtrl(); } + #endif -//------------------------------------------------------------------------------ void OFieldDescGenWin::SaveData( OFieldDescription* pFieldDescr ) { DBG_CHKTHIS(OFieldDescGenWin,NULL); m_pFieldControl->SaveData(pFieldDescr); } -//------------------------------------------------------------------------------ + void OFieldDescGenWin::GetFocus() { DBG_CHKTHIS(OFieldDescGenWin,NULL); - ////////////////////////////////////////////////////////////////////// // Setzt den Focus auf das zuletzt aktive Control TabPage::GetFocus(); if(m_pFieldControl) m_pFieldControl->GetFocus(); } -//------------------------------------------------------------------------------ + void OFieldDescGenWin::LoseFocus() { DBG_CHKTHIS(OFieldDescGenWin,NULL); m_pFieldControl->LoseFocus(); TabPage::LoseFocus(); } -//------------------------------------------------------------------ + String OFieldDescGenWin::BoolStringPersistent(const String& rUIString) const { return m_pFieldControl->BoolStringPersistent(rUIString); } -//------------------------------------------------------------------ String OFieldDescGenWin::BoolStringUI(const String& rPersistentString) const { return m_pFieldControl->BoolStringUI(rPersistentString); } -// ----------------------------------------------------------------------------- + sal_Bool OFieldDescGenWin::isCopyAllowed() { return (m_pFieldControl && m_pFieldControl->isCutAllowed()); } -// ----------------------------------------------------------------------------- + sal_Bool OFieldDescGenWin::isCutAllowed() { return (m_pFieldControl && m_pFieldControl->isCutAllowed()); } -// ----------------------------------------------------------------------------- + sal_Bool OFieldDescGenWin::isPasteAllowed() { return (m_pFieldControl && m_pFieldControl->isPasteAllowed()); } -// ----------------------------------------------------------------------------- + void OFieldDescGenWin::cut() { if(m_pFieldControl) m_pFieldControl->cut(); } -// ----------------------------------------------------------------------------- + void OFieldDescGenWin::copy() { if(m_pFieldControl) m_pFieldControl->copy(); } -// ----------------------------------------------------------------------------- + void OFieldDescGenWin::paste() { if(m_pFieldControl) m_pFieldControl->paste(); } -// ----------------------------------------------------------------------------- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx b/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx index e77ba06ad233..59dd95785029 100644 --- a/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx +++ b/dbaccess/source/ui/tabledesign/FieldDescGenWin.hxx @@ -28,7 +28,6 @@ namespace dbaui class OFieldDescription; class OTableFieldControl; class OTableEditorCtrl; - //================================================================== class OFieldDescGenWin : public TabPage ,public IClipboardTest { diff --git a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx index f1c6606cca48..1eb193aaf79a 100644 --- a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx +++ b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx @@ -33,18 +33,14 @@ #define DEFAULT_NUMERIC_PRECSION 5 #define DEFAULT_NUMERIC_SCALE 0 - using namespace dbaui; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::util; -//======================================================================== // class OFieldDescription -//======================================================================== DBG_NAME(OFieldDescription) -//------------------------------------------------------------------------------ OFieldDescription::OFieldDescription() :m_pType() ,m_nType(DataType::VARCHAR) @@ -60,7 +56,7 @@ OFieldDescription::OFieldDescription() { DBG_CTOR(OFieldDescription,NULL); } -//------------------------------------------------------------------------------ + OFieldDescription::OFieldDescription( const OFieldDescription& rDescr ) :m_aDefaultValue(rDescr.m_aDefaultValue) ,m_aControlDefault(rDescr.m_aControlDefault) @@ -87,12 +83,11 @@ OFieldDescription::OFieldDescription( const OFieldDescription& rDescr ) DBG_CTOR(OFieldDescription,NULL); } -//------------------------------------------------------------------------------ OFieldDescription::~OFieldDescription() { DBG_DTOR(OFieldDescription,NULL); } -//------------------------------------------------------------------------------ + OFieldDescription::OFieldDescription(const Reference< XPropertySet >& xAffectedCol,sal_Bool _bUseAsDest) :m_pType() ,m_nType(DataType::VARCHAR) @@ -176,7 +171,7 @@ OFieldDescription::OFieldDescription(const Reference< XPropertySet >& xAffectedC } } } -// ----------------------------------------------------------------------------- + void OFieldDescription::FillFromTypeInfo(const TOTypeInfoSP& _pType,sal_Bool _bForce,sal_Bool _bReset) { TOTypeInfoSP pOldType = getTypeInfo(); @@ -245,7 +240,7 @@ void OFieldDescription::FillFromTypeInfo(const TOTypeInfoSP& _pType,sal_Bool _bF SetTypeName(_pType->aTypeName); } } -// ----------------------------------------------------------------------------- + void OFieldDescription::SetName(const OUString& _rName) { try @@ -260,7 +255,7 @@ void OFieldDescription::SetName(const OUString& _rName) DBG_UNHANDLED_EXCEPTION(); } } -// ----------------------------------------------------------------------------- + void OFieldDescription::SetHelpText(const OUString& _sHelpText) { try @@ -275,7 +270,7 @@ void OFieldDescription::SetHelpText(const OUString& _sHelpText) DBG_UNHANDLED_EXCEPTION(); } } -// ----------------------------------------------------------------------------- + void OFieldDescription::SetDescription(const OUString& _rDescription) { try @@ -290,7 +285,7 @@ void OFieldDescription::SetDescription(const OUString& _rDescription) DBG_UNHANDLED_EXCEPTION(); } } -// ----------------------------------------------------------------------------- + void OFieldDescription::SetDefaultValue(const Any& _rDefaultValue) { try @@ -305,7 +300,7 @@ void OFieldDescription::SetDefaultValue(const Any& _rDefaultValue) DBG_UNHANDLED_EXCEPTION(); } } -// ----------------------------------------------------------------------------- + void OFieldDescription::SetControlDefault(const Any& _rControlDefault) { try @@ -320,7 +315,7 @@ void OFieldDescription::SetControlDefault(const Any& _rControlDefault) DBG_UNHANDLED_EXCEPTION(); } } -// ----------------------------------------------------------------------------- + void OFieldDescription::SetAutoIncrementValue(const OUString& _sAutoIncValue) { try @@ -335,7 +330,7 @@ void OFieldDescription::SetAutoIncrementValue(const OUString& _sAutoIncValue) DBG_UNHANDLED_EXCEPTION(); } } -// ----------------------------------------------------------------------------- + void OFieldDescription::SetType(TOTypeInfoSP _pType) { m_pType = _pType; @@ -354,7 +349,7 @@ void OFieldDescription::SetType(TOTypeInfoSP _pType) } } } -// ----------------------------------------------------------------------------- + void OFieldDescription::SetTypeValue(sal_Int32 _nType) { try @@ -372,7 +367,7 @@ void OFieldDescription::SetTypeValue(sal_Int32 _nType) DBG_UNHANDLED_EXCEPTION(); } } -// ----------------------------------------------------------------------------- + void OFieldDescription::SetPrecision(const sal_Int32& _rPrecision) { try @@ -387,7 +382,7 @@ void OFieldDescription::SetPrecision(const sal_Int32& _rPrecision) DBG_UNHANDLED_EXCEPTION(); } } -// ----------------------------------------------------------------------------- + void OFieldDescription::SetScale(const sal_Int32& _rScale) { try @@ -402,7 +397,7 @@ void OFieldDescription::SetScale(const sal_Int32& _rScale) DBG_UNHANDLED_EXCEPTION(); } } -// ----------------------------------------------------------------------------- + void OFieldDescription::SetIsNullable(const sal_Int32& _rIsNullable) { try @@ -417,7 +412,7 @@ void OFieldDescription::SetIsNullable(const sal_Int32& _rIsNullable) DBG_UNHANDLED_EXCEPTION(); } } -// ----------------------------------------------------------------------------- + void OFieldDescription::SetFormatKey(const sal_Int32& _rFormatKey) { try @@ -432,7 +427,7 @@ void OFieldDescription::SetFormatKey(const sal_Int32& _rFormatKey) DBG_UNHANDLED_EXCEPTION(); } } -// ----------------------------------------------------------------------------- + void OFieldDescription::SetHorJustify(const SvxCellHorJustify& _rHorJustify) { try @@ -447,7 +442,7 @@ void OFieldDescription::SetHorJustify(const SvxCellHorJustify& _rHorJustify) DBG_UNHANDLED_EXCEPTION(); } } -// ----------------------------------------------------------------------------- + void OFieldDescription::SetAutoIncrement(sal_Bool _bAuto) { try @@ -462,19 +457,18 @@ void OFieldDescription::SetAutoIncrement(sal_Bool _bAuto) DBG_UNHANDLED_EXCEPTION(); } } -// ----------------------------------------------------------------------------- + void OFieldDescription::SetPrimaryKey(sal_Bool _bPKey) { m_bIsPrimaryKey = _bPKey; if ( _bPKey ) SetIsNullable(::com::sun::star::sdbc::ColumnValue::NO_NULLS); } -// ----------------------------------------------------------------------------- + void OFieldDescription::SetCurrency(sal_Bool _bIsCurrency) { m_bIsCurrency = _bIsCurrency; } -// ----------------------------------------------------------------------------- OUString OFieldDescription::GetName() const { @@ -483,7 +477,7 @@ OUString OFieldDescription::GetName() const else return m_sName; } -// ----------------------------------------------------------------------------- + OUString OFieldDescription::GetDescription() const { if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_DESCRIPTION) ) @@ -491,7 +485,7 @@ OUString OFieldDescription::GetDescription() const else return m_sDescription; } -// ----------------------------------------------------------------------------- + OUString OFieldDescription::GetHelpText() const { if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_HELPTEXT) ) @@ -499,7 +493,7 @@ OUString OFieldDescription::GetHelpText() const else return m_sHelpText; } -// ----------------------------------------------------------------------------- + ::com::sun::star::uno::Any OFieldDescription::GetControlDefault() const { if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_CONTROLDEFAULT) ) @@ -507,7 +501,7 @@ OUString OFieldDescription::GetHelpText() const else return m_aControlDefault; } -// ----------------------------------------------------------------------------- + OUString OFieldDescription::GetAutoIncrementValue() const { if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_AUTOINCREMENTCREATION) ) @@ -515,7 +509,7 @@ OUString OFieldDescription::GetAutoIncrementValue() const else return m_sAutoIncrementValue; } -// ----------------------------------------------------------------------------- + sal_Int32 OFieldDescription::GetType() const { if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_TYPE) ) @@ -523,7 +517,7 @@ sal_Int32 OFieldDescription::GetType() const else return m_pType.get() ? m_pType->nType : m_nType; } -// ----------------------------------------------------------------------------- + OUString OFieldDescription::GetTypeName() const { if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_TYPENAME) ) @@ -531,7 +525,7 @@ OUString OFieldDescription::GetTypeName() const else return m_pType.get() ? m_pType->aTypeName : m_sTypeName; } -// ----------------------------------------------------------------------------- + sal_Int32 OFieldDescription::GetPrecision() const { sal_Int32 nPrec = m_nPrecision; @@ -555,7 +549,7 @@ sal_Int32 OFieldDescription::GetPrecision() const return nPrec; } -// ----------------------------------------------------------------------------- + sal_Int32 OFieldDescription::GetScale() const { if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_SCALE) ) @@ -563,7 +557,7 @@ sal_Int32 OFieldDescription::GetScale() const else return m_nScale; } -// ----------------------------------------------------------------------------- + sal_Int32 OFieldDescription::GetIsNullable() const { if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_ISNULLABLE) ) @@ -571,7 +565,7 @@ sal_Int32 OFieldDescription::GetIsNullable() const else return m_nIsNullable; } -// ----------------------------------------------------------------------------- + sal_Int32 OFieldDescription::GetFormatKey() const { if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_FORMATKEY) ) @@ -579,7 +573,7 @@ sal_Int32 OFieldDescription::GetFormatKey() const else return m_nFormatKey; } -// ----------------------------------------------------------------------------- + SvxCellHorJustify OFieldDescription::GetHorJustify() const { if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_ALIGN) ) @@ -587,12 +581,12 @@ SvxCellHorJustify OFieldDescription::GetHorJustify() const else return m_eHorJustify; } -// ----------------------------------------------------------------------------- + TOTypeInfoSP OFieldDescription::getTypeInfo() const { return m_pType; } -// ----------------------------------------------------------------------------- + TOTypeInfoSP OFieldDescription::getSpecialTypeInfo() const { TOTypeInfoSP pSpecialType( new OTypeInfo() ); @@ -602,7 +596,7 @@ TOTypeInfoSP OFieldDescription::getSpecialTypeInfo() const pSpecialType->bAutoIncrement = IsAutoIncrement(); // http://dba.openoffice.org/issues/show_bug.cgi?id=115398 fixed by ludob return pSpecialType; } -// ----------------------------------------------------------------------------- + sal_Bool OFieldDescription::IsAutoIncrement() const { if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_ISAUTOINCREMENT) ) @@ -610,17 +604,17 @@ sal_Bool OFieldDescription::IsAutoIncrement() const else return m_bIsAutoIncrement; } -// ----------------------------------------------------------------------------- + sal_Bool OFieldDescription::IsPrimaryKey() const { return m_bIsPrimaryKey; } -// ----------------------------------------------------------------------------- + sal_Bool OFieldDescription::IsCurrency() const { return m_bIsCurrency; } -// ----------------------------------------------------------------------------- + sal_Bool OFieldDescription::IsNullable() const { if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_ISNULLABLE) ) @@ -628,7 +622,7 @@ sal_Bool OFieldDescription::IsNullable() const else return m_nIsNullable == ::com::sun::star::sdbc::ColumnValue::NULLABLE; } -// ----------------------------------------------------------------------------- + void OFieldDescription::SetTypeName(const OUString& _sTypeName) { try @@ -643,7 +637,7 @@ void OFieldDescription::SetTypeName(const OUString& _sTypeName) DBG_UNHANDLED_EXCEPTION(); } } -// ----------------------------------------------------------------------------- + void OFieldDescription::copyColumnSettingsTo(const Reference< XPropertySet >& _rxColumn) { if ( _rxColumn.is() ) @@ -667,6 +661,5 @@ void OFieldDescription::copyColumnSettingsTo(const Reference< XPropertySet >& _r _rxColumn->setPropertyValue(PROPERTY_HIDDEN,makeAny(m_bHidden)); } } -// ----------------------------------------------------------------------------- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx index 6786a3814918..af425a1eb98c 100644 --- a/dbaccess/source/ui/tabledesign/TEditControl.cxx +++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx @@ -65,13 +65,10 @@ namespace dbaui { extern String GetTypeString( sal_uInt16 nType ); } -//============================================================================== // TYPEINIT1(OTableEditorCtrl, DBView); DBG_NAME(OTableEditorCtrl) -//============================================================================== - #define HANDLE_ID 0 // default field widths @@ -82,9 +79,7 @@ DBG_NAME(OTableEditorCtrl) // Maximum length in description field #define MAX_DESCR_LEN 256 -//================================================================== DBG_NAME(ClipboardInvalidator) -//------------------------------------------------------------------ OTableEditorCtrl::ClipboardInvalidator::ClipboardInvalidator(sal_uLong nTimeout,OTableEditorCtrl* _pOwner) : m_pOwner(_pOwner) { @@ -95,7 +90,6 @@ OTableEditorCtrl::ClipboardInvalidator::ClipboardInvalidator(sal_uLong nTimeout, m_aInvalidateTimer.Start(); } -//------------------------------------------------------------------ OTableEditorCtrl::ClipboardInvalidator::~ClipboardInvalidator() { m_aInvalidateTimer.Stop(); @@ -103,7 +97,6 @@ OTableEditorCtrl::ClipboardInvalidator::~ClipboardInvalidator() DBG_DTOR(ClipboardInvalidator,NULL); } -//------------------------------------------------------------------ IMPL_LINK_NOARG(OTableEditorCtrl::ClipboardInvalidator, OnInvalidate) { m_pOwner->GetView()->getController().InvalidateFeature(SID_CUT); @@ -112,19 +105,16 @@ IMPL_LINK_NOARG(OTableEditorCtrl::ClipboardInvalidator, OnInvalidate) return 0L; } -//================================================================== void OTableEditorCtrl::Init() { DBG_CHKTHIS(OTableEditorCtrl,NULL); OTableRowView::Init(); - ////////////////////////////////////////////////////////////////////// // Should it be opened ReadOnly ? sal_Bool bRead(GetView()->getController().isReadOnly()); SetReadOnly( bRead ); - ////////////////////////////////////////////////////////////////////// // Insert the columns String aColumnName( ModuleRes(STR_TAB_FIELD_COLUMN_NAME) ); InsertDataColumn( FIELD_NAME, aColumnName, FIELDNAME_WIDTH ); @@ -145,12 +135,10 @@ void OTableEditorCtrl::Init() InitCellController(); - ////////////////////////////////////////////////////////////////////// // Insert the rows RowInserted(0, m_pRowList->size(), sal_True); } -//================================================================== void OTableEditorCtrl::UpdateAll() { DBG_CHKTHIS(OTableEditorCtrl,NULL); @@ -160,7 +148,7 @@ void OTableEditorCtrl::UpdateAll() InvalidateFeatures(); Invalidate(); } -//================================================================== + OTableEditorCtrl::OTableEditorCtrl(Window* pWindow) :OTableRowView(pWindow) ,pNameCell(NULL) @@ -189,20 +177,17 @@ OTableEditorCtrl::OTableEditorCtrl(Window* pWindow) m_nDataPos = 0; } -//------------------------------------------------------------------------------ SfxUndoManager& OTableEditorCtrl::GetUndoManager() const { return GetView()->getController().GetUndoManager(); } -//------------------------------------------------------------------------------ sal_Bool OTableEditorCtrl::IsReadOnly() { DBG_CHKTHIS(OTableEditorCtrl,NULL); return bReadOnly; } -//------------------------------------------------------------------------------ void OTableEditorCtrl::SetReadOnly( sal_Bool bRead ) { // nothing to do? @@ -214,13 +199,11 @@ void OTableEditorCtrl::SetReadOnly( sal_Bool bRead ) DBG_CHKTHIS(OTableEditorCtrl,NULL); bReadOnly = bRead; - ////////////////////////////////////////////////////////////////////// // Disable active cells long nRow(GetCurRow()); sal_uInt16 nCol(GetCurColumnId()); DeactivateCell(); - ////////////////////////////////////////////////////////////////////// // Select the correct Browsers cursor BrowserMode nMode(BROWSER_COLUMNSELECTION | BROWSER_MULTISELECTION | BROWSER_KEEPSELECTION | BROWSER_HLINESFULL | BROWSER_VLINESFULL|BROWSER_AUTOSIZE_LASTCOL); @@ -232,11 +215,9 @@ void OTableEditorCtrl::SetReadOnly( sal_Bool bRead ) ActivateCell( nRow, nCol ); } -//------------------------------------------------------------------------------ void OTableEditorCtrl::InitCellController() { DBG_CHKTHIS(OTableEditorCtrl,NULL); - ////////////////////////////////////////////////////////////////////// // Cell Field name xub_StrLen nMaxTextLen = EDIT_NOLIMIT; OUString sExtraNameChars; @@ -262,13 +243,10 @@ void OTableEditorCtrl::InitCellController() pNameCell->SetMaxTextLen( nMaxTextLen ); pNameCell->setCheck( isSQL92CheckEnabled(xCon) ); - - ////////////////////////////////////////////////////////////////////// // Cell type pTypeCell = new ListBoxControl( &GetDataWindow() ); pTypeCell->SetDropDownLineCount( 15 ); - ////////////////////////////////////////////////////////////////////// // Cell description pDescrCell = new Edit( &GetDataWindow(), WB_LEFT ); pDescrCell->SetMaxTextLen( MAX_DESCR_LEN ); @@ -294,7 +272,6 @@ void OTableEditorCtrl::InitCellController() ClearModified(); } -//------------------------------------------------------------------------------ void OTableEditorCtrl::ClearModified() { DBG_CHKTHIS(OTableEditorCtrl,NULL); @@ -304,15 +281,12 @@ void OTableEditorCtrl::ClearModified() pTypeCell->SaveValue(); } -//------------------------------------------------------------------------------ OTableEditorCtrl::~OTableEditorCtrl() { DBG_DTOR(OTableEditorCtrl,NULL); - ////////////////////////////////////////////////////////////////////// // Reset the Undo-Manager GetUndoManager().Clear(); - ////////////////////////////////////////////////////////////////////// // Take possible Events from the queue if( nCutEvent ) Application::RemoveUserEvent( nCutEvent ); @@ -325,7 +299,6 @@ OTableEditorCtrl::~OTableEditorCtrl() if( nInvalidateTypeEvent ) Application::RemoveUserEvent( nInvalidateTypeEvent ); - ////////////////////////////////////////////////////////////////////// // Delete the control types delete pNameCell; delete pTypeCell; @@ -333,7 +306,6 @@ OTableEditorCtrl::~OTableEditorCtrl() delete pHelpTextCell; } -//------------------------------------------------------------------------------ sal_Bool OTableEditorCtrl::SetDataPtr( long nRow ) { DBG_CHKTHIS(OTableEditorCtrl,NULL); @@ -347,7 +319,6 @@ sal_Bool OTableEditorCtrl::SetDataPtr( long nRow ) return pActRow != 0; } -//------------------------------------------------------------------------------ sal_Bool OTableEditorCtrl::SeekRow(long _nRow) { // Call the Base class to remember which row must be repainted @@ -358,7 +329,6 @@ sal_Bool OTableEditorCtrl::SeekRow(long _nRow) return SetDataPtr(_nRow); } -//------------------------------------------------------------------------------ void OTableEditorCtrl::PaintCell(OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId ) const { @@ -371,11 +341,9 @@ void OTableEditorCtrl::PaintCell(OutputDevice& rDev, const Rectangle& rRect, rDev.Pop(); } -//------------------------------------------------------------------------------ CellController* OTableEditorCtrl::GetController(long nRow, sal_uInt16 nColumnId) { DBG_CHKTHIS(OTableEditorCtrl,NULL); - ////////////////////////////////////////////////////////////////////// // If EditorCtrl is ReadOnly, editing is forbidden Reference<XPropertySet> xTable = GetView()->getController().getTable(); if (IsReadOnly() || ( xTable.is() && @@ -383,7 +351,6 @@ CellController* OTableEditorCtrl::GetController(long nRow, sal_uInt16 nColumnId) ::comphelper::getString(xTable->getPropertyValue(PROPERTY_TYPE)) == OUString("VIEW"))) return NULL; - ////////////////////////////////////////////////////////////////////// // If the row is ReadOnly, editing is forbidden SetDataPtr( nRow ); if( pActRow->IsReadOnly() ) @@ -413,7 +380,6 @@ CellController* OTableEditorCtrl::GetController(long nRow, sal_uInt16 nColumnId) } } -//------------------------------------------------------------------------------ void OTableEditorCtrl::InitController(CellControllerRef&, long nRow, sal_uInt16 nColumnId) { DBG_CHKTHIS(OTableEditorCtrl,NULL); @@ -434,7 +400,6 @@ void OTableEditorCtrl::InitController(CellControllerRef&, long nRow, sal_uInt16 if ( pActFieldDescr && pActFieldDescr->getTypeInfo() ) aInitString = pActFieldDescr->getTypeInfo()->aUIName; - ////////////////////////////////////////////////////////////// // Set the ComboBox contents pTypeCell->Clear(); if( !pActFieldDescr ) @@ -465,7 +430,6 @@ void OTableEditorCtrl::InitController(CellControllerRef&, long nRow, sal_uInt16 } } -//------------------------------------------------------------------------------ EditBrowseBox::RowStatus OTableEditorCtrl::GetRowStatus(long nRow) const { DBG_CHKTHIS(OTableEditorCtrl,NULL); @@ -486,7 +450,6 @@ EditBrowseBox::RowStatus OTableEditorCtrl::GetRowStatus(long nRow) const } } -//------------------------------------------------------------------------------ sal_Bool OTableEditorCtrl::SaveCurRow() { DBG_CHKTHIS(OTableEditorCtrl,NULL); @@ -501,7 +464,6 @@ sal_Bool OTableEditorCtrl::SaveCurRow() return sal_True; } -//------------------------------------------------------------------------------ void OTableEditorCtrl::DisplayData(long nRow, sal_Bool bGrabFocus) { // go to the correct cell @@ -529,11 +491,9 @@ void OTableEditorCtrl::DisplayData(long nRow, sal_Bool bGrabFocus) ActivateCell(nRow, GetCurColumnId(), bGrabFocus); } -//------------------------------------------------------------------------------ void OTableEditorCtrl::CursorMoved() { DBG_CHKTHIS(OTableEditorCtrl,NULL); - ////////////////////////////////////////////////////////////////////// // New line ? m_nDataPos = GetCurRow(); if( m_nDataPos != nOldDataPos && m_nDataPos != -1) @@ -548,7 +508,6 @@ void OTableEditorCtrl::CursorMoved() OTableRowView::CursorMoved(); } -//------------------------------------------------------------------------------ sal_Int32 OTableEditorCtrl::HasFieldName( const String& rFieldName ) { DBG_CHKTHIS(OTableEditorCtrl,NULL); @@ -570,28 +529,24 @@ sal_Int32 OTableEditorCtrl::HasFieldName( const String& rFieldName ) } return nCount; } -// -------------------------------------------------------------------------------------- + sal_Bool OTableEditorCtrl::SaveData(long nRow, sal_uInt16 nColId) { DBG_CHKTHIS(OTableEditorCtrl,NULL); - ////////////////////////////////////////////////////////////// // Store the cell content SetDataPtr( nRow == -1 ? GetCurRow() : nRow); OFieldDescription* pActFieldDescr = pActRow->GetActFieldDescr(); switch( nColId) { - ////////////////////////////////////////////////////////////// // Store NameCell case FIELD_NAME: { - ////////////////////////////////////////////////////////////// // If there is no name, do nothing String aName(pNameCell->GetText()); if( !aName.Len() ) { - ////////////////////////////////////////////////////////////// // If FieldDescr exists, the field is deleted and the old content restored if (pActFieldDescr) { @@ -609,16 +564,13 @@ sal_Bool OTableEditorCtrl::SaveData(long nRow, sal_uInt16 nColId) break; } - ////////////////////////////////////////////////////////////// // Store the field type case FIELD_TYPE: break; - ////////////////////////////////////////////////////////////// // Store DescrCell case HELP_TEXT: { - ////////////////////////////////////////////////////////////// // Wenn aktuelle Feldbeschreibung NULL, Default setzen if( !pActFieldDescr ) { @@ -631,7 +583,6 @@ sal_Bool OTableEditorCtrl::SaveData(long nRow, sal_uInt16 nColId) } case COLUMN_DESCRIPTION: { - ////////////////////////////////////////////////////////////// // Set the default if the field description is null if( !pActFieldDescr ) { @@ -667,7 +618,6 @@ sal_Bool OTableEditorCtrl::SaveData(long nRow, sal_uInt16 nColId) return sal_True; } -//------------------------------------------------------------------------------ sal_Bool OTableEditorCtrl::SaveModified() { DBG_CHKTHIS(OTableEditorCtrl,NULL); @@ -675,11 +625,9 @@ sal_Bool OTableEditorCtrl::SaveModified() switch( nColId ) { - ////////////////////////////////////////////////////////////// // Fieled type case FIELD_TYPE: { - ////////////////////////////////////////////////////////////////////// // Reset the type resetType(); } break; @@ -688,7 +636,6 @@ sal_Bool OTableEditorCtrl::SaveModified() return sal_True; } -//------------------------------------------------------------------------------ sal_Bool OTableEditorCtrl::CursorMoving(long nNewRow, sal_uInt16 nNewCol) { DBG_CHKTHIS(OTableEditorCtrl,NULL); @@ -696,22 +643,18 @@ sal_Bool OTableEditorCtrl::CursorMoving(long nNewRow, sal_uInt16 nNewCol) if (!EditBrowseBox::CursorMoving(nNewRow, nNewCol)) return sal_False; - ////////////////////////////////////////////////////////////////////// // Called after SaveModified(), current row is still the old one m_nDataPos = nNewRow; nOldDataPos = GetCurRow(); - ////////////////////////////////////////////////////////////////////// // Reset the markers InvalidateStatusCell( nOldDataPos ); InvalidateStatusCell( m_nDataPos ); - ////////////////////////////////////////////////////////////////////// // Store the data from the Property window if( SetDataPtr(nOldDataPos) && pDescrWin) pDescrWin->SaveData( pActRow->GetActFieldDescr() ); - ////////////////////////////////////////////////////////////////////// // Show new data in the Property window if( SetDataPtr(m_nDataPos) && pDescrWin) pDescrWin->DisplayData( pActRow->GetActFieldDescr() ); @@ -719,7 +662,6 @@ sal_Bool OTableEditorCtrl::CursorMoving(long nNewRow, sal_uInt16 nNewCol) return sal_True; } -//------------------------------------------------------------------------------ IMPL_LINK( OTableEditorCtrl, InvalidateFieldType, void*, /*EMPTYTAG*/ ) { DBG_CHKTHIS(OTableEditorCtrl,NULL); @@ -729,12 +671,10 @@ IMPL_LINK( OTableEditorCtrl, InvalidateFieldType, void*, /*EMPTYTAG*/ ) return 0; } -//------------------------------------------------------------------------------ void OTableEditorCtrl::CellModified( long nRow, sal_uInt16 nColId ) { DBG_CHKTHIS(OTableEditorCtrl,NULL); - ////////////////////////////////////////////////////////////// // If the description is null, use the default if(nRow == -1) nRow = GetCurRow(); @@ -787,12 +727,11 @@ void OTableEditorCtrl::CellModified( long nRow, sal_uInt16 nColId ) if(xController.Is()) xController->SetModified(); - ////////////////////////////////////////////////////////////////////// // Set the Modify flag GetView()->getController().setModified( sal_True ); InvalidateFeatures(); } -// ----------------------------------------------------------------------------- + void OTableEditorCtrl::resetType() { sal_uInt16 nPos = pTypeCell->GetSelectEntryPos(); @@ -801,43 +740,40 @@ void OTableEditorCtrl::resetType() else SwitchType(TOTypeInfoSP()); } -//------------------------------------------------------------------------------ + void OTableEditorCtrl::CellModified() { DBG_CHKTHIS(OTableEditorCtrl,NULL); CellModified( GetCurRow(), GetCurColumnId() ); } -// ----------------------------------------------------------------------------- + void OTableEditorCtrl::InvalidateFeatures() { GetView()->getController().InvalidateFeature(SID_UNDO); GetView()->getController().InvalidateFeature(SID_REDO); GetView()->getController().InvalidateFeature(SID_SAVEDOC); } -//------------------------------------------------------------------------------ + void OTableEditorCtrl::Undo() { DBG_CHKTHIS(OTableEditorCtrl,NULL); InvalidateFeatures(); } -//------------------------------------------------------------------------------ + void OTableEditorCtrl::Redo() { DBG_CHKTHIS(OTableEditorCtrl,NULL); InvalidateFeatures(); } -//------------------------------------------------------------------------------ void OTableEditorCtrl::CopyRows() { DBG_CHKTHIS(OTableEditorCtrl,NULL); - ////////////////////////////////////////////////////////////////////// // set to the right row and save it if( SetDataPtr(m_nDataPos) ) pDescrWin->SaveData( pActRow->GetActFieldDescr() ); - ////////////////////////////////////////////////////////////////////// // Copy selected rows to the ClipboardList ::boost::shared_ptr<OTableRow> pClipboardRow; ::boost::shared_ptr<OTableRow> pRow; @@ -862,11 +798,9 @@ void OTableEditorCtrl::CopyRows() } } -//------------------------------------------------------------------------------ String OTableEditorCtrl::GenerateName( const String& rName ) { DBG_CHKTHIS(OTableEditorCtrl,NULL); - ////////////////////////////////////////////////////////////////////// // Create a base name for appending numbers to String aBaseName; Reference<XConnection> xCon = GetView()->getController().getConnection(); @@ -879,7 +813,6 @@ String OTableEditorCtrl::GenerateName( const String& rName ) else aBaseName = rName; - ////////////////////////////////////////////////////////////////////// // append a sequential number to the base name (up to 99) String aFieldName( rName); sal_Int32 i=1; @@ -892,13 +825,11 @@ String OTableEditorCtrl::GenerateName( const String& rName ) return aFieldName; } -//------------------------------------------------------------------------------ void OTableEditorCtrl::InsertRows( long nRow ) { DBG_CHKTHIS(OTableEditorCtrl,NULL); ::std::vector< ::boost::shared_ptr<OTableRow> > vInsertedUndoRedoRows; // need for undo/redo handling - ////////////////////////////////////////////////////////////////////// // get rows from clipboard TransferableDataHelper aTransferData(TransferableDataHelper::CreateFromSystemClipboard(GetParent())); if(aTransferData.HasFormat(SOT_FORMATSTR_ID_SBA_TABED)) @@ -923,7 +854,6 @@ void OTableEditorCtrl::InsertRows( long nRow ) sal_Int32 nType = pRow->GetActFieldDescr()->GetType(); if ( pRow->GetActFieldDescr() ) pRow->GetActFieldDescr()->SetType(GetView()->getController().getTypeInfoByType(nType)); - ////////////////////////////////////////////////////////////////////// // Adjust the field names aFieldName = GenerateName( pRow->GetActFieldDescr()->GetName() ); pRow->GetActFieldDescr()->SetName( aFieldName ); @@ -934,31 +864,25 @@ void OTableEditorCtrl::InsertRows( long nRow ) } } } - ////////////////////////////////////////////////////////////////////// // RowInserted calls CursorMoved. // The UI data should not be stored here. bSaveOnMove = sal_False; RowInserted( nRow,vInsertedUndoRedoRows.size(),sal_True ); bSaveOnMove = sal_True; - ////////////////////////////////////////////////////////////////////// // Create the Undo-Action GetUndoManager().AddUndoAction( new OTableEditorInsUndoAct(this, nRow,vInsertedUndoRedoRows) ); GetView()->getController().setModified( sal_True ); InvalidateFeatures(); } -//------------------------------------------------------------------------------ void OTableEditorCtrl::DeleteRows() { DBG_CHKTHIS(OTableEditorCtrl,NULL); OSL_ENSURE(GetView()->getController().isDropAllowed(),"Call of DeleteRows not valid here. Please check isDropAllowed!"); - ////////////////////////////////////////////////////////////////////// // Create the Undo-Action GetUndoManager().AddUndoAction( new OTableEditorDelUndoAct(this) ); - - ////////////////////////////////////////////////////////////////////// // Delete all marked rows long nIndex = FirstSelectedRow(); nOldDataPos = nIndex; @@ -966,12 +890,10 @@ void OTableEditorCtrl::DeleteRows() while( nIndex >= 0 && nIndex < static_cast<long>(m_pRowList->size()) ) { - ////////////////////////////////////////////////////////////////////// // Remove rows m_pRowList->erase( m_pRowList->begin()+nIndex ); RowRemoved( nIndex, 1, sal_True ); - ////////////////////////////////////////////////////////////////////// // Insert the empty row at the end m_pRowList->push_back( ::boost::shared_ptr<OTableRow>(new OTableRow())); RowInserted( GetRowCount()-1, 1, sal_True ); @@ -981,7 +903,6 @@ void OTableEditorCtrl::DeleteRows() bSaveOnMove = sal_True; - ////////////////////////////////////////////////////////////////////// // Force the current record to be displayed m_nDataPos = GetCurRow(); InvalidateStatusCell( nOldDataPos ); @@ -993,18 +914,15 @@ void OTableEditorCtrl::DeleteRows() InvalidateFeatures(); } -//------------------------------------------------------------------------------ void OTableEditorCtrl::InsertNewRows( long nRow ) { DBG_CHKTHIS(OTableEditorCtrl,NULL); OSL_ENSURE(GetView()->getController().isAddAllowed(),"Call of InsertNewRows not valid here. Please check isAppendAllowed!"); - ////////////////////////////////////////////////////////////////////// // Create Undo-Action long nInsertRows = GetSelectRowCount(); if( !nInsertRows ) nInsertRows = 1; GetUndoManager().AddUndoAction( new OTableEditorInsNewUndoAct(this, nRow, nInsertRows) ); - ////////////////////////////////////////////////////////////////////// // Insert the number of of selected rows for( long i=nRow; i<(nRow+nInsertRows); i++ ) m_pRowList->insert( m_pRowList->begin()+i ,::boost::shared_ptr<OTableRow>(new OTableRow())); @@ -1014,11 +932,9 @@ void OTableEditorCtrl::InsertNewRows( long nRow ) InvalidateFeatures(); } -//------------------------------------------------------------------------------ String OTableEditorCtrl::GetControlText( long nRow, sal_uInt16 nColId ) { DBG_CHKTHIS(OTableEditorCtrl,NULL); - ////////////////////////////////////////////////////////////////////// // Read the Browser Controls if( nColId < FIELD_FIRST_VIRTUAL_COLUMN ) { @@ -1031,17 +947,14 @@ String OTableEditorCtrl::GetControlText( long nRow, sal_uInt16 nColId ) return GetCellText(nRow,nColId); } - ////////////////////////////////////////////////////////////////////// // Read the Controls on the Tabpage else return pDescrWin->GetControlText( nColId ); } -//------------------------------------------------------------------------------ void OTableEditorCtrl::SetControlText( long nRow, sal_uInt16 nColId, const String& rText ) { DBG_CHKTHIS(OTableEditorCtrl,NULL); - ////////////////////////////////////////////////////////////////////// // Set the Browser Controls if( nColId < FIELD_FIRST_VIRTUAL_COLUMN ) { @@ -1054,18 +967,16 @@ void OTableEditorCtrl::SetControlText( long nRow, sal_uInt16 nColId, const Strin RowModified(nRow,nColId); } - ////////////////////////////////////////////////////////////////////// // Set the Tabpage controls else { pDescrWin->SetControlText( nColId, rText ); } } -//------------------------------------------------------------------------------ + void OTableEditorCtrl::SetCellData( long nRow, sal_uInt16 nColId, const TOTypeInfoSP& _pTypeInfo ) { DBG_CHKTHIS(OTableEditorCtrl,NULL); - ////////////////////////////////////////////////////////////////////// // Relocate the current pointer if( nRow == -1 ) nRow = GetCurRow(); @@ -1073,7 +984,6 @@ void OTableEditorCtrl::SetCellData( long nRow, sal_uInt16 nColId, const TOTypeIn if( !pFieldDescr && nColId != FIELD_TYPE) return; - ////////////////////////////////////////////////////////////////////// // Set individual fields switch( nColId ) { @@ -1085,11 +995,10 @@ void OTableEditorCtrl::SetCellData( long nRow, sal_uInt16 nColId, const TOTypeIn } SetControlText(nRow,nColId,_pTypeInfo.get() ? _pTypeInfo->aUIName : OUString()); } -//------------------------------------------------------------------------------ + void OTableEditorCtrl::SetCellData( long nRow, sal_uInt16 nColId, const ::com::sun::star::uno::Any& _rNewData ) { DBG_CHKTHIS(OTableEditorCtrl,NULL); - ////////////////////////////////////////////////////////////////////// // Relocate the current pointer if( nRow == -1 ) nRow = GetCurRow(); @@ -1098,7 +1007,6 @@ void OTableEditorCtrl::SetCellData( long nRow, sal_uInt16 nColId, const ::com::s return; String sValue; - ////////////////////////////////////////////////////////////////////// // Set indvidual fields switch( nColId ) { @@ -1169,7 +1077,6 @@ void OTableEditorCtrl::SetCellData( long nRow, sal_uInt16 nColId, const ::com::s SetControlText(nRow,nColId,sValue); } -//------------------------------------------------------------------------------ Any OTableEditorCtrl::GetCellData( long nRow, sal_uInt16 nColId ) { DBG_CHKTHIS(OTableEditorCtrl,NULL); @@ -1177,7 +1084,6 @@ Any OTableEditorCtrl::GetCellData( long nRow, sal_uInt16 nColId ) if( !pFieldDescr ) return Any(); - ////////////////////////////////////////////////////////////////////// // Relocate the current pointer if( nRow==-1 ) nRow = GetCurRow(); @@ -1186,7 +1092,6 @@ Any OTableEditorCtrl::GetCellData( long nRow, sal_uInt16 nColId ) static const String strYes(ModuleRes(STR_VALUE_YES)); static const String strNo(ModuleRes(STR_VALUE_NO)); OUString sValue; - ////////////////////////////////////////////////////////////////////// // Read out the fields switch( nColId ) { @@ -1242,7 +1147,6 @@ Any OTableEditorCtrl::GetCellData( long nRow, sal_uInt16 nColId ) return makeAny(sValue); } -//------------------------------------------------------------------------------ OUString OTableEditorCtrl::GetCellText( long nRow, sal_uInt16 nColId ) const { DBG_CHKTHIS(OTableEditorCtrl,NULL); @@ -1251,14 +1155,12 @@ OUString OTableEditorCtrl::GetCellText( long nRow, sal_uInt16 nColId ) const return sCellText; } -//------------------------------------------------------------------------------ sal_uInt32 OTableEditorCtrl::GetTotalCellWidth(long nRow, sal_uInt16 nColId) { DBG_CHKTHIS(OTableEditorCtrl,NULL); return GetTextWidth(GetCellText(nRow, nColId)) + 2 * GetTextWidth(OUString('0')); } -//------------------------------------------------------------------------------ OFieldDescription* OTableEditorCtrl::GetFieldDescr( long nRow ) { DBG_CHKTHIS(OTableEditorCtrl,NULL); @@ -1275,7 +1177,6 @@ OFieldDescription* OTableEditorCtrl::GetFieldDescr( long nRow ) return pRow->GetActFieldDescr(); } -//------------------------------------------------------------------------------ sal_Bool OTableEditorCtrl::IsCutAllowed( long nRow ) { DBG_CHKTHIS(OTableEditorCtrl,NULL); @@ -1307,7 +1208,6 @@ sal_Bool OTableEditorCtrl::IsCutAllowed( long nRow ) return bIsCutAllowed; } -//------------------------------------------------------------------------------ sal_Bool OTableEditorCtrl::IsCopyAllowed( long /*nRow*/ ) { DBG_CHKTHIS(OTableEditorCtrl,NULL); @@ -1324,7 +1224,6 @@ sal_Bool OTableEditorCtrl::IsCopyAllowed( long /*nRow*/ ) if( !GetSelectRowCount() || (xTable.is() && ::comphelper::getString(xTable->getPropertyValue(PROPERTY_TYPE)) == "VIEW")) return sal_False; - ////////////////////////////////////////////////////////////////////// // If one of the selected rows is empty, Copy is not possible ::boost::shared_ptr<OTableRow> pRow; long nIndex = FirstSelectedRow(); @@ -1343,7 +1242,6 @@ sal_Bool OTableEditorCtrl::IsCopyAllowed( long /*nRow*/ ) return bIsCopyAllowed; } -//------------------------------------------------------------------------------ sal_Bool OTableEditorCtrl::IsPasteAllowed( long /*nRow*/ ) { DBG_CHKTHIS(OTableEditorCtrl,NULL); @@ -1361,7 +1259,6 @@ sal_Bool OTableEditorCtrl::IsPasteAllowed( long /*nRow*/ ) return bAllowed; } -//------------------------------------------------------------------------------ void OTableEditorCtrl::cut() { if(m_eChildFocus == NAME) @@ -1399,7 +1296,6 @@ void OTableEditorCtrl::cut() } } -//------------------------------------------------------------------------------ void OTableEditorCtrl::copy() { if(GetSelectRowCount()) @@ -1412,7 +1308,6 @@ void OTableEditorCtrl::copy() pDescrCell->Copy(); } -//------------------------------------------------------------------------------ void OTableEditorCtrl::paste() { TransferableDataHelper aTransferData(TransferableDataHelper::CreateFromSystemClipboard(GetParent())); @@ -1448,7 +1343,6 @@ void OTableEditorCtrl::paste() } } -//------------------------------------------------------------------------------ sal_Bool OTableEditorCtrl::IsDeleteAllowed( long /*nRow*/ ) { DBG_CHKTHIS(OTableEditorCtrl,NULL); @@ -1456,13 +1350,11 @@ sal_Bool OTableEditorCtrl::IsDeleteAllowed( long /*nRow*/ ) return GetSelectRowCount() != 0 && GetView()->getController().isDropAllowed(); } -//------------------------------------------------------------------------------ sal_Bool OTableEditorCtrl::IsInsertNewAllowed( long nRow ) { DBG_CHKTHIS(OTableEditorCtrl,NULL); sal_Bool bInsertNewAllowed = GetView()->getController().isAddAllowed(); - ////////////////////////////////////////////////////////////// // If fields can be added, Paste in the new fields if (bInsertNewAllowed && !GetView()->getController().isDropAllowed()) { @@ -1474,7 +1366,6 @@ sal_Bool OTableEditorCtrl::IsInsertNewAllowed( long nRow ) return bInsertNewAllowed; } -//------------------------------------------------------------------------------ sal_Bool OTableEditorCtrl::IsPrimaryKeyAllowed( long /*nRow*/ ) { DBG_CHKTHIS(OTableEditorCtrl,NULL); @@ -1486,13 +1377,11 @@ sal_Bool OTableEditorCtrl::IsPrimaryKeyAllowed( long /*nRow*/ ) return sal_False; Reference<XPropertySet> xTable = rController.getTable(); - ////////////////////////////////////////////////////////////// // Key must not be changed // This applies only if the table is not new and not a ::com::sun::star::sdbcx::View. Otherwise no DROP is executed if(xTable.is() && ::comphelper::getString(xTable->getPropertyValue(PROPERTY_TYPE)) == "VIEW") return sal_False; - ////////////////////////////////////////////////////////////// // If there is an empty field, no primary key // The entry is only permitted if // - there are no empty entries in the selection @@ -1508,7 +1397,6 @@ sal_Bool OTableEditorCtrl::IsPrimaryKeyAllowed( long /*nRow*/ ) return sal_False; else { - ////////////////////////////////////////////////////////////// // Memo and Image fields cannot be primary keys // or if the columne cannot be dropped and the Required flag is not set // or if a ::com::sun::star::sdbcx::View is avalable and the Required flag is not set @@ -1525,7 +1413,6 @@ sal_Bool OTableEditorCtrl::IsPrimaryKeyAllowed( long /*nRow*/ ) return sal_True; } -//------------------------------------------------------------------------------ void OTableEditorCtrl::Command(const CommandEvent& rEvt) { DBG_CHKTHIS(OTableEditorCtrl,NULL); @@ -1558,7 +1445,6 @@ void OTableEditorCtrl::Command(const CommandEvent& rEvt) } } - ////////////////////////////////////////////////////////////// // Show the Context menu if( !IsReadOnly() ) { @@ -1604,7 +1490,6 @@ void OTableEditorCtrl::Command(const CommandEvent& rEvt) if( SetDataPtr(m_nDataPos) ) pDescrWin->SaveData( pActRow->GetActFieldDescr() ); - ////////////////////////////////////////////////////////////// // All actions which change the number of rows must be run asynchronously // otherwise there may be problems between the Context menu and the Browser m_nDataPos = GetCurRow(); @@ -1645,7 +1530,6 @@ void OTableEditorCtrl::Command(const CommandEvent& rEvt) } -//------------------------------------------------------------------------------ IMPL_LINK( OTableEditorCtrl, DelayedCut, void*, /*EMPTYTAG*/ ) { nCutEvent = 0; @@ -1653,7 +1537,6 @@ IMPL_LINK( OTableEditorCtrl, DelayedCut, void*, /*EMPTYTAG*/ ) return 0; } -//------------------------------------------------------------------------------ IMPL_LINK( OTableEditorCtrl, DelayedPaste, void*, /*EMPTYTAG*/ ) { nPasteEvent = 0; @@ -1682,7 +1565,6 @@ IMPL_LINK( OTableEditorCtrl, DelayedPaste, void*, /*EMPTYTAG*/ ) return 0; } -//------------------------------------------------------------------------------ IMPL_LINK( OTableEditorCtrl, DelayedDelete, void*, /*EMPTYTAG*/ ) { nDeleteEvent = 0; @@ -1690,7 +1572,6 @@ IMPL_LINK( OTableEditorCtrl, DelayedDelete, void*, /*EMPTYTAG*/ ) return 0; } -//------------------------------------------------------------------------------ IMPL_LINK( OTableEditorCtrl, DelayedInsNewRows, void*, /*EMPTYTAG*/ ) { DBG_CHKTHIS(OTableEditorCtrl,NULL); @@ -1705,7 +1586,7 @@ IMPL_LINK( OTableEditorCtrl, DelayedInsNewRows, void*, /*EMPTYTAG*/ ) return 0; } -// ----------------------------------------------------------------------------- + void OTableEditorCtrl::AdjustFieldDescription(OFieldDescription* _pFieldDesc, MultiSelection& _rMultiSel, sal_Int32 _nPos, @@ -1726,18 +1607,16 @@ void OTableEditorCtrl::AdjustFieldDescription(OFieldDescription* _pFieldDesc, _pFieldDesc->SetAutoIncrement(false); } } - ////////////////////////////////////////////////////////////////////// // update field description pDescrWin->DisplayData(_pFieldDesc); _rMultiSel.Insert( _nPos ); _rMultiSel.Select( _nPos ); } -//------------------------------------------------------------------------------ + void OTableEditorCtrl::SetPrimaryKey( sal_Bool bSet ) { DBG_CHKTHIS(OTableEditorCtrl,NULL); - ////////////////////////////////////////////////////////////////////// // Delete any existing Primary Keys MultiSelection aDeletedPrimKeys; aDeletedPrimKeys.SetTotalRange( Range(0,GetRowCount()) ); @@ -1753,7 +1632,6 @@ void OTableEditorCtrl::SetPrimaryKey( sal_Bool bSet ) } } - ////////////////////////////////////////////////////////////////////// // Set the primary keys of the marked rows MultiSelection aInsertedPrimKeys; aInsertedPrimKeys.SetTotalRange( Range(0,GetRowCount()) ); @@ -1762,7 +1640,6 @@ void OTableEditorCtrl::SetPrimaryKey( sal_Bool bSet ) long nIndex = FirstSelectedRow(); while( nIndex >= 0 && nIndex < static_cast<long>(m_pRowList->size()) ) { - ////////////////////////////////////////////////////////////////////// // Set the key ::boost::shared_ptr<OTableRow> pRow = (*m_pRowList)[nIndex]; OFieldDescription* pFieldDescr = pRow->GetActFieldDescr(); @@ -1775,22 +1652,17 @@ void OTableEditorCtrl::SetPrimaryKey( sal_Bool bSet ) GetUndoManager().AddUndoAction( new OPrimKeyUndoAct(this, aDeletedPrimKeys, aInsertedPrimKeys) ); - ////////////////////////////////////////////////////////////////////// // Invalidate the handle-columns InvalidateHandleColumn(); - - ////////////////////////////////////////////////////////////////////// // Set the TableDocSh's ModifyFlag GetView()->getController().setModified( sal_True ); InvalidateFeatures(); } -//------------------------------------------------------------------------------ sal_Bool OTableEditorCtrl::IsPrimaryKey() { DBG_CHKTHIS(OTableEditorCtrl,NULL); - ////////////////////////////////////////////////////////////////////// // Are all marked fields part of the Primary Key ? long nPrimaryKeys = 0; ::std::vector< ::boost::shared_ptr<OTableRow> >::const_iterator aIter = m_pRowList->begin(); @@ -1803,27 +1675,22 @@ sal_Bool OTableEditorCtrl::IsPrimaryKey() ++nPrimaryKeys; } - ////////////////////////////////////////////////////////////////////// // Are there any unselected fields that are part of the Key ? return GetSelectRowCount() == nPrimaryKeys; } -//------------------------------------------------------------------------------ void OTableEditorCtrl::SwitchType( const TOTypeInfoSP& _pType ) { DBG_CHKTHIS(OTableEditorCtrl,NULL); - ////////////////////////////////////////////////////////////////////// // if there is no assigned field name long nRow(GetCurRow()); OFieldDescription* pActFieldDescr = GetFieldDescr( nRow ); if( pActFieldDescr ) - ////////////////////////////////////////////////////////////////////// // Store the old description pDescrWin->SaveData( pActFieldDescr ); if ( nRow < 0 || nRow > static_cast<long>(m_pRowList->size()) ) return; - ////////////////////////////////////////////////////////////////////// // Show the new description ::boost::shared_ptr<OTableRow> pRow = (*m_pRowList)[nRow]; pRow->SetFieldType( _pType, sal_True ); @@ -1863,12 +1730,12 @@ void OTableEditorCtrl::SwitchType( const TOTypeInfoSP& _pType ) pDescrWin->DisplayData( pActFieldDescr ); } -// ----------------------------------------------------------------------------- + OTableDesignView* OTableEditorCtrl::GetView() const { return static_cast<OTableDesignView*>(GetParent()->GetParent()); } -// ----------------------------------------------------------------------------- + void OTableEditorCtrl::DeactivateCell(sal_Bool bUpdate) { OTableRowView::DeactivateCell(bUpdate); @@ -1877,7 +1744,7 @@ void OTableEditorCtrl::DeactivateCell(sal_Bool bUpdate) if (pDescrWin) pDescrWin->SetReadOnly(bReadOnly || !SetDataPtr(nRow) || GetActRow()->IsReadOnly()); } -//------------------------------------------------------------------------------ + long OTableEditorCtrl::PreNotify( NotifyEvent& rNEvt ) { if (rNEvt.GetType() == EVENT_GETFOCUS) @@ -1894,9 +1761,5 @@ long OTableEditorCtrl::PreNotify( NotifyEvent& rNEvt ) return OTableRowView::PreNotify(rNEvt); } -// ----------------------------------------------------------------------------- - - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ui/tabledesign/TEditControl.hxx b/dbaccess/source/ui/tabledesign/TEditControl.hxx index 92394940b9e0..5f55f4281139 100644 --- a/dbaccess/source/ui/tabledesign/TEditControl.hxx +++ b/dbaccess/source/ui/tabledesign/TEditControl.hxx @@ -66,7 +66,6 @@ namespace dbaui sal_Bool bSaveOnMove; sal_Bool bReadOnly; - //------------------------------------------------------------------ // Hilfsklasse class ClipboardInvalidator { @@ -206,6 +205,4 @@ namespace dbaui } #endif // DBAUI_TABLEEDITORCONTROL_HXX - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx index 2b53bef2d5d7..db9a5ca5da3d 100644 --- a/dbaccess/source/ui/tabledesign/TableController.cxx +++ b/dbaccess/source/ui/tabledesign/TableController.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - #include "FieldDescriptions.hxx" #include "TEditControl.hxx" #include "TableController.hxx" @@ -111,7 +110,6 @@ namespace xNameCont->dropByName(_sTableName); } } - //------------------------------------------------------------------------------ struct OTableRowCompare : public ::std::binary_function< ::boost::shared_ptr<OTableRow> , OUString, bool> { bool operator() (const ::boost::shared_ptr<OTableRow> lhs, const OUString& rhs) const @@ -123,37 +121,34 @@ namespace } -//------------------------------------------------------------------------------ OUString SAL_CALL OTableController::getImplementationName() throw( RuntimeException ) { return getImplementationName_Static(); } -//------------------------------------------------------------------------------ OUString OTableController::getImplementationName_Static() throw( RuntimeException ) { return OUString("org.openoffice.comp.dbu.OTableDesign"); } -//------------------------------------------------------------------------------ + Sequence< OUString> OTableController::getSupportedServiceNames_Static(void) throw( RuntimeException ) { Sequence< OUString> aSupported(1); aSupported.getArray()[0] = OUString("com.sun.star.sdb.TableDesign"); return aSupported; } -//------------------------------------------------------------------------- + Sequence< OUString> SAL_CALL OTableController::getSupportedServiceNames() throw(RuntimeException) { return getSupportedServiceNames_Static(); } -// ------------------------------------------------------------------------- + Reference< XInterface > SAL_CALL OTableController::Create(const Reference<XMultiServiceFactory >& _rxFactory) { return *(new OTableController(comphelper::getComponentContext(_rxFactory))); } DBG_NAME(OTableController) -// ----------------------------------------------------------------------------- OTableController::OTableController(const Reference< XComponentContext >& _rM) : OTableController_BASE(_rM) ,m_sTypeNames(ModuleRes(STR_TABLEDESIGN_DBFIELDTYPES)) ,m_pTypeInfo() @@ -166,7 +161,7 @@ OTableController::OTableController(const Reference< XComponentContext >& _rM) : m_pTypeInfo = TOTypeInfoSP(new OTypeInfo()); m_pTypeInfo->aUIName = m_sTypeNames.GetToken(TYPE_OTHER); } -// ----------------------------------------------------------------------------- + OTableController::~OTableController() { m_aTypeInfoIndex.clear(); @@ -175,7 +170,6 @@ OTableController::~OTableController() DBG_DTOR(OTableController,NULL); } -// ----------------------------------------------------------------------------- void OTableController::startTableListening() { Reference< XComponent > xComponent(m_xTable, UNO_QUERY); @@ -183,7 +177,6 @@ void OTableController::startTableListening() xComponent->addEventListener(static_cast<XModifyListener*>(this)); } -// ----------------------------------------------------------------------------- void OTableController::stopTableListening() { Reference< XComponent > xComponent(m_xTable, UNO_QUERY); @@ -191,7 +184,6 @@ void OTableController::stopTableListening() xComponent->removeEventListener(static_cast<XModifyListener*>(this)); } -// ----------------------------------------------------------------------------- void OTableController::disposing() { OTableController_BASE::disposing(); @@ -199,7 +191,7 @@ void OTableController::disposing() m_vRowList.clear(); } -// ----------------------------------------------------------------------------- + FeatureState OTableController::GetState(sal_uInt16 _nId) const { FeatureState aReturn; @@ -261,7 +253,7 @@ FeatureState OTableController::GetState(sal_uInt16 _nId) const } return aReturn; } -// ----------------------------------------------------------------------------- + void OTableController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >& aArgs) { switch(_nId) @@ -297,7 +289,6 @@ void OTableController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >& InvalidateFeature(_nId); } -// ----------------------------------------------------------------------------- sal_Bool OTableController::doSaveDoc(sal_Bool _bSaveAs) { if (!isConnected()) @@ -464,7 +455,6 @@ sal_Bool OTableController::doSaveDoc(sal_Bool _bSaveAs) return ! (aInfo.isValid() || bError); } -// ----------------------------------------------------------------------------- void OTableController::doEditIndexes() { // table needs to be saved before editing indexes @@ -519,7 +509,6 @@ void OTableController::doEditIndexes() } -// ----------------------------------------------------------------------------- void OTableController::impl_initialize() { try @@ -561,14 +550,14 @@ void OTableController::impl_initialize() DBG_UNHANDLED_EXCEPTION(); } } -// ----------------------------------------------------------------------------- + sal_Bool OTableController::Construct(Window* pParent) { setView( * new OTableDesignView( pParent, getORB(), *this ) ); OTableController_BASE::Construct(pParent); return sal_True; } -// ----------------------------------------------------------------------------- + sal_Bool SAL_CALL OTableController::suspend(sal_Bool /*_bSuspend*/) throw( RuntimeException ) { if ( getBroadcastHelper().bInDispose || getBroadcastHelper().bDisposed ) @@ -631,7 +620,7 @@ sal_Bool SAL_CALL OTableController::suspend(sal_Bool /*_bSuspend*/) throw( Runti return bCheck; } -// ----------------------------------------------------------------------------- + void OTableController::describeSupportedFeatures() { OSingleDocumentController::describeSupportedFeatures(); @@ -645,13 +634,13 @@ void OTableController::describeSupportedFeatures() implDescribeSupportedFeature( ".uno:DBIndexDesign", SID_INDEXDESIGN, CommandGroup::APPLICATION ); implDescribeSupportedFeature( ".uno:EditDoc", ID_BROWSER_EDITDOC, CommandGroup::EDIT ); } -// ----------------------------------------------------------------------------- + void OTableController::impl_onModifyChanged() { OSingleDocumentController::impl_onModifyChanged(); InvalidateFeature( SID_INDEXDESIGN ); } -// ----------------------------------------------------------------------------- + void SAL_CALL OTableController::disposing( const EventObject& _rSource ) throw(RuntimeException) { if ( _rSource.Source == m_xTable ) @@ -664,19 +653,18 @@ void SAL_CALL OTableController::disposing( const EventObject& _rSource ) throw(R else OTableController_BASE::disposing( _rSource ); } -// ----------------------------------------------------------------------------- + void OTableController::Save(const Reference< XObjectOutputStream>& _rxOut) { OStreamSection aSection(_rxOut.get()); } -// ----------------------------------------------------------------------------- + void OTableController::Load(const Reference< XObjectInputStream>& _rxIn) { OStreamSection aSection(_rxIn.get()); } -// ----------------------------------------------------------------------------- void OTableController::losingConnection( ) { // let the base class do it's reconnect @@ -699,12 +687,12 @@ void OTableController::losingConnection( ) } InvalidateAll(); } -// ----------------------------------------------------------------------------- + TOTypeInfoSP OTableController::getTypeInfoByType(sal_Int32 _nDataType) const { return queryTypeInfoByType(_nDataType,m_aTypeInfo); } -// ----------------------------------------------------------------------------- + void OTableController::appendColumns(Reference<XColumnsSupplier>& _rxColSup,sal_Bool _bNew,sal_Bool _bKeyColumns) { try @@ -765,7 +753,7 @@ void OTableController::appendColumns(Reference<XColumnsSupplier>& _rxColSup,sal_ DBG_UNHANDLED_EXCEPTION(); } } -// ----------------------------------------------------------------------------- + void OTableController::appendPrimaryKey(Reference<XKeysSupplier>& _rxSup,sal_Bool _bNew) { if(!_rxSup.is()) @@ -807,16 +795,14 @@ void OTableController::appendPrimaryKey(Reference<XKeysSupplier>& _rxSup,sal_Boo xAppend->appendByDescriptor(xKey); } } -// ----------------------------------------------------------------------------- + void OTableController::loadData() { - ////////////////////////////////////////////////////////////////////// // Wenn Datenstruktur bereits vorhanden, Struktur leeren m_vRowList.clear(); ::boost::shared_ptr<OTableRow> pTabEdRow; Reference< XDatabaseMetaData> xMetaData = getMetaData( ); - ////////////////////////////////////////////////////////////////////// // Datenstruktur mit Daten aus DatenDefinitionsObjekt fuellen if(m_xTable.is() && xMetaData.is()) { @@ -824,7 +810,6 @@ void OTableController::loadData() OSL_ENSURE(xColSup.is(),"No XColumnsSupplier!"); Reference<XNameAccess> xColumns = xColSup->getColumns(); OFieldDescription* pActFieldDescr = NULL; - ////////////////////////////////////////////////////////////////////// // ReadOnly-Flag // Bei Drop darf keine Zeile editierbar sein. // Bei Add duerfen nur die leeren Zeilen editierbar sein. @@ -893,7 +878,6 @@ void OTableController::loadData() pActFieldDescr->SetHorJustify(dbaui::mapTextJustify(nAlign)); pActFieldDescr->SetCurrency(bIsCurrency); - ////////////////////////////////////////////////////////////////////// // Spezielle Daten pActFieldDescr->SetIsNullable(nNullable); pActFieldDescr->SetControlDefault(aControlDefault); @@ -926,7 +910,6 @@ void OTableController::loadData() } } - ////////////////////////////////////////////////////////////////////// // Leere Zeilen fuellen OTypeInfoMap::iterator aTypeIter = m_aTypeInfo.find(DataType::VARCHAR); @@ -943,12 +926,12 @@ void OTableController::loadData() m_vRowList.push_back( pTabEdRow); } } -// ----------------------------------------------------------------------------- + Reference<XNameAccess> OTableController::getKeyColumns() const { return getPrimaryKeyColumns_throw(m_xTable); } -// ----------------------------------------------------------------------------- + sal_Bool OTableController::checkColumns(sal_Bool _bNew) throw(::com::sun::star::sdbc::SQLException) { sal_Bool bOk = sal_True; @@ -1016,7 +999,7 @@ sal_Bool OTableController::checkColumns(sal_Bool _bNew) throw(::com::sun::star:: } return bOk; } -// ----------------------------------------------------------------------------- + void OTableController::alterColumns() { Reference<XColumnsSupplier> xColSup(m_xTable,UNO_QUERY_THROW); @@ -1141,7 +1124,6 @@ void OTableController::alterColumns() bReload = sal_True; } - } else if(xColumnFactory.is() && xAlter.is() && nPos < nColumnCount) { // we can't find the column so we could try it with the index before we drop and append a new column @@ -1302,7 +1284,6 @@ void OTableController::alterColumns() } } - // check if we have to do something with the primary key sal_Bool bNeedDropKey = sal_False; sal_Bool bNeedAppendKey = sal_False; @@ -1351,7 +1332,7 @@ void OTableController::alterColumns() if ( bReload ) reload(); } -// ----------------------------------------------------------------------------- + void OTableController::dropPrimaryKey() { SQLExceptionInfo aInfo; @@ -1398,7 +1379,7 @@ void OTableController::dropPrimaryKey() showError(aInfo); } -// ----------------------------------------------------------------------------- + void OTableController::assignTable() { // get the table @@ -1431,7 +1412,7 @@ void OTableController::assignTable() } } } -// ----------------------------------------------------------------------------- + sal_Bool OTableController::isAddAllowed() const { Reference<XColumnsSupplier> xColsSup(m_xTable,UNO_QUERY); @@ -1452,7 +1433,7 @@ sal_Bool OTableController::isAddAllowed() const return bAddAllowed; } -// ----------------------------------------------------------------------------- + sal_Bool OTableController::isDropAllowed() const { Reference<XColumnsSupplier> xColsSup(m_xTable,UNO_QUERY); @@ -1468,13 +1449,13 @@ sal_Bool OTableController::isDropAllowed() const return bDropAllowed; } -// ----------------------------------------------------------------------------- + sal_Bool OTableController::isAlterAllowed() const { sal_Bool bAllowed(!m_xTable.is() || Reference<XAlterTable>(m_xTable,UNO_QUERY).is()); return bAllowed; } -// ----------------------------------------------------------------------------- + void OTableController::reSyncRows() { sal_Bool bAlterAllowed = isAlterAllowed(); @@ -1496,7 +1477,7 @@ void OTableController::reSyncRows() ClearUndoManager(); setModified(sal_False); // and we are not modified yet } -// ----------------------------------------------------------------------------- + OUString OTableController::createUniqueName(const OUString& _rName) { OUString sName = _rName; @@ -1517,7 +1498,7 @@ OUString OTableController::createUniqueName(const OUString& _rName) } return sName; } -// ----------------------------------------------------------------------------- + OUString OTableController::getPrivateTitle() const { OUString sTitle; @@ -1544,7 +1525,7 @@ OUString OTableController::getPrivateTitle() const } return sTitle; } -// ----------------------------------------------------------------------------- + void OTableController::reload() { loadData(); // fill the column information form the table @@ -1553,7 +1534,7 @@ void OTableController::reload() setModified(sal_False); // and we are not modified yet static_cast<OTableDesignView*>(getView())->Invalidate(); } -// ----------------------------------------------------------------------------- + sal_Int32 OTableController::getFirstEmptyRowPosition() { sal_Int32 nRet = -1; @@ -1577,11 +1558,10 @@ sal_Int32 OTableController::getFirstEmptyRowPosition() } return nRet; } -// ----------------------------------------------------------------------------- + bool OTableController::isAutoIncrementPrimaryKey() const { return getSdbMetaData().isAutoIncrementPrimaryKey(); } -// ----------------------------------------------------------------------------- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ui/tabledesign/TableDesignControl.cxx b/dbaccess/source/ui/tabledesign/TableDesignControl.cxx index ca2bea139c21..54b068834f4d 100644 --- a/dbaccess/source/ui/tabledesign/TableDesignControl.cxx +++ b/dbaccess/source/ui/tabledesign/TableDesignControl.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - #include "TableDesignControl.hxx" #include "dbu_tbl.hrc" #include "TableDesignView.hxx" @@ -36,7 +35,6 @@ using namespace ::com::sun::star::util; #define HANDLE_ID 0 DBG_NAME(OTableRowView) -//------------------------------------------------------------------------ OTableRowView::OTableRowView(Window* pParent) :EditBrowseBox(pParent, ModuleRes(RID_DB_TAB_EDITOR),EBBF_NONE, BROWSER_COLUMNSELECTION | BROWSER_MULTISELECTION | BROWSER_AUTOSIZE_LASTCOL | @@ -52,14 +50,12 @@ OTableRowView::OTableRowView(Window* pParent) } -//------------------------------------------------------------------------ OTableRowView::~OTableRowView() { DBG_DTOR(OTableRowView,NULL); } -//------------------------------------------------------------------------ void OTableRowView::Init() { EditBrowseBox::Init(); @@ -84,7 +80,6 @@ void OTableRowView::Init() SetMode(nMode); } -//------------------------------------------------------------------------ void OTableRowView::KeyInput( const KeyEvent& rEvt ) { if (IsDeleteAllowed(0)) @@ -106,14 +101,12 @@ void OTableRowView::KeyInput( const KeyEvent& rEvt ) EditBrowseBox::KeyInput(rEvt); } -//------------------------------------------------------------------------ void OTableRowView::SetUpdatable( sal_Bool bUpdate ) { m_bUpdatable = bUpdate; } -//------------------------------------------------------------------------ void OTableRowView::Command(const CommandEvent& rEvt) { @@ -174,32 +167,27 @@ void OTableRowView::Command(const CommandEvent& rEvt) } -//------------------------------------------------------------------------------ void OTableRowView::cut() { CopyRows(); DeleteRows(); } -//------------------------------------------------------------------------------ void OTableRowView::copy() { CopyRows(); } -//------------------------------------------------------------------------------ void OTableRowView::paste() { OSL_FAIL("OTableRowView::Paste : (pseudo-) abstract method called !"); } -//------------------------------------------------------------------------------ void OTableRowView::Paste( long nRow ) { InsertRows( nRow ); } -//------------------------------------------------------------------------------ EditBrowseBox::RowStatus OTableRowView::GetRowStatus(long nRow) const { if (nRow >= 0 && m_nDataPos == nRow) @@ -208,6 +196,4 @@ EditBrowseBox::RowStatus OTableRowView::GetRowStatus(long nRow) const return CLEAN; } - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ui/tabledesign/TableDesignHelpBar.cxx b/dbaccess/source/ui/tabledesign/TableDesignHelpBar.cxx index bb3d91675cc8..bf949420c901 100644 --- a/dbaccess/source/ui/tabledesign/TableDesignHelpBar.cxx +++ b/dbaccess/source/ui/tabledesign/TableDesignHelpBar.cxx @@ -24,11 +24,8 @@ #include <memory> using namespace dbaui; #define STANDARD_MARGIN 6 -//================================================================== // class OTableDesignHelpBar -//================================================================== DBG_NAME(OTableDesignHelpBar) -//------------------------------------------------------------------------------ OTableDesignHelpBar::OTableDesignHelpBar( Window* pParent ) : TabPage( pParent, WB_3DLOOK ) { @@ -40,7 +37,6 @@ OTableDesignHelpBar::OTableDesignHelpBar( Window* pParent ) : m_pTextWin->Show(); } -//------------------------------------------------------------------------------ OTableDesignHelpBar::~OTableDesignHelpBar() { DBG_DTOR(OTableDesignHelpBar,NULL); @@ -48,7 +44,6 @@ OTableDesignHelpBar::~OTableDesignHelpBar() m_pTextWin = NULL; } -//------------------------------------------------------------------------------ void OTableDesignHelpBar::SetHelpText( const String& rText ) { DBG_CHKTHIS(OTableDesignHelpBar,NULL); @@ -57,15 +52,12 @@ void OTableDesignHelpBar::SetHelpText( const String& rText ) Invalidate(); } -//------------------------------------------------------------------------------ void OTableDesignHelpBar::Resize() { DBG_CHKTHIS(OTableDesignHelpBar,NULL); - ////////////////////////////////////////////////////////////////////// // Abmessungen parent window Size aOutputSize( GetOutputSizePixel() ); - ////////////////////////////////////////////////////////////////////// // TextWin anpassen if(m_pTextWin) m_pTextWin->SetPosSizePixel( Point(STANDARD_MARGIN+1, STANDARD_MARGIN+1), @@ -74,39 +66,38 @@ void OTableDesignHelpBar::Resize() } -//------------------------------------------------------------------------------ long OTableDesignHelpBar::PreNotify( NotifyEvent& rNEvt ) { if (rNEvt.GetType() == EVENT_LOSEFOCUS) SetHelpText(String()); return TabPage::PreNotify(rNEvt); } -// ----------------------------------------------------------------------------- + sal_Bool OTableDesignHelpBar::isCopyAllowed() { return m_pTextWin && !m_pTextWin->GetSelected().isEmpty(); } -// ----------------------------------------------------------------------------- + sal_Bool OTableDesignHelpBar::isCutAllowed() { return sal_False; } -// ----------------------------------------------------------------------------- + sal_Bool OTableDesignHelpBar::isPasteAllowed() { return sal_False; } -// ----------------------------------------------------------------------------- + void OTableDesignHelpBar::cut() { } -// ----------------------------------------------------------------------------- + void OTableDesignHelpBar::copy() { if ( m_pTextWin ) m_pTextWin->Copy(); } -// ----------------------------------------------------------------------------- + void OTableDesignHelpBar::paste() { } diff --git a/dbaccess/source/ui/tabledesign/TableDesignView.cxx b/dbaccess/source/ui/tabledesign/TableDesignView.cxx index a82ae839d9cc..29c8c5554b67 100644 --- a/dbaccess/source/ui/tabledesign/TableDesignView.cxx +++ b/dbaccess/source/ui/tabledesign/TableDesignView.cxx @@ -31,7 +31,6 @@ #include <unotools/syslocale.hxx> #include "UITools.hxx" - using namespace ::dbaui; using namespace ::utl; using namespace ::com::sun::star::uno; @@ -39,17 +38,14 @@ using namespace ::com::sun::star::datatransfer::clipboard; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; -//================================================================== // class OTableBorderWindow DBG_NAME(OTableBorderWindow) -//================================================================== OTableBorderWindow::OTableBorderWindow(Window* pParent) : Window(pParent,WB_BORDER) ,m_aHorzSplitter( this ) { DBG_CTOR(OTableBorderWindow,NULL); ImplInitSettings( sal_True, sal_True, sal_True ); - ////////////////////////////////////////////////////////////////////// // Children erzeugen m_pEditorCtrl = new OTableEditorCtrl( this); m_pFieldDescWin = new OTableFieldDescWin( this ); @@ -59,15 +55,13 @@ OTableBorderWindow::OTableBorderWindow(Window* pParent) : Window(pParent,WB_BORD // set depending windows and controls m_pEditorCtrl->SetDescrWin(m_pFieldDescWin); - ////////////////////////////////////////////////////////////////////// // Splitter einrichten m_aHorzSplitter.SetSplitHdl( LINK(this, OTableBorderWindow, SplitHdl) ); m_aHorzSplitter.Show(); } -// ----------------------------------------------------------------------------- + OTableBorderWindow::~OTableBorderWindow() { - ////////////////////////////////////////////////////////////////////// // Children zerstoeren // ::dbaui::notifySystemWindow(this,m_pFieldDescWin,::comphelper::mem_fun(&TaskPaneList::RemoveWindow)); m_pEditorCtrl->Hide(); @@ -88,19 +82,17 @@ OTableBorderWindow::~OTableBorderWindow() DBG_DTOR(OTableBorderWindow,NULL); } -// ----------------------------------------------------------------------------- + void OTableBorderWindow::Resize() { const long nSplitterHeight(3); - ////////////////////////////////////////////////////////////////////// // Abmessungen parent window Size aOutputSize( GetOutputSize() ); long nOutputWidth = aOutputSize.Width(); long nOutputHeight = aOutputSize.Height(); long nSplitPos = m_aHorzSplitter.GetSplitPosPixel(); - ////////////////////////////////////////////////////////////////////// // Verschiebebereich Splitter mittleres Drittel des Outputs long nDragPosY = nOutputHeight/3; long nDragSizeHeight = nOutputHeight/3; @@ -108,19 +100,17 @@ void OTableBorderWindow::Resize() if( (nSplitPos < nDragPosY) || (nSplitPos > (nDragPosY+nDragSizeHeight)) ) nSplitPos = nDragPosY+nDragSizeHeight-5; - ////////////////////////////////////////////////////////////////////// // Splitter setzen m_aHorzSplitter.SetPosSizePixel( Point( 0, nSplitPos ), Size(nOutputWidth, nSplitterHeight)); m_aHorzSplitter.SetSplitPosPixel( nSplitPos ); - ////////////////////////////////////////////////////////////////////// // Fenster setzen m_pEditorCtrl->SetPosSizePixel( Point(0, 0), Size(nOutputWidth , nSplitPos) ); m_pFieldDescWin->SetPosSizePixel( Point(0, nSplitPos+nSplitterHeight), Size(nOutputWidth, nOutputHeight-nSplitPos-nSplitterHeight) ); } -//------------------------------------------------------------------------------ + IMPL_LINK( OTableBorderWindow, SplitHdl, Splitter*, pSplit ) { if(pSplit == &m_aHorzSplitter) @@ -130,7 +120,7 @@ IMPL_LINK( OTableBorderWindow, SplitHdl, Splitter*, pSplit ) } return 0; } -// ----------------------------------------------------------------------------- + void OTableBorderWindow::ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); @@ -159,7 +149,7 @@ void OTableBorderWindow::ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, SetBackground( rStyleSettings.GetFaceColor() ); } } -// ----------------------------------------------------------------------- + void OTableBorderWindow::DataChanged( const DataChangedEvent& rDCEvt ) { Window::DataChanged( rDCEvt ); @@ -171,7 +161,7 @@ void OTableBorderWindow::DataChanged( const DataChangedEvent& rDCEvt ) Invalidate(); } } -// ----------------------------------------------------------------------------- + void OTableBorderWindow::GetFocus() { Window::GetFocus(); @@ -181,11 +171,8 @@ void OTableBorderWindow::GetFocus() m_pEditorCtrl->GrabFocus(); } -//================================================================== // class OTableDesignView -//================================================================== DBG_NAME(OTableDesignView); -//------------------------------------------------------------------------------ OTableDesignView::OTableDesignView( Window* pParent, const Reference< XComponentContext >& _rxOrb, OTableController& _rController @@ -208,7 +195,6 @@ OTableDesignView::OTableDesignView( Window* pParent, m_pWin->Show(); } -//------------------------------------------------------------------------------ OTableDesignView::~OTableDesignView() { DBG_DTOR(OTableDesignView,NULL); @@ -222,7 +208,6 @@ OTableDesignView::~OTableDesignView() } } -// ----------------------------------------------------------------------------- void OTableDesignView::initialize() { GetEditorCtrl()->Init(); @@ -234,9 +219,7 @@ void OTableDesignView::initialize() GetEditorCtrl()->DisplayData(0); } -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ void OTableDesignView::resizeDocumentView(Rectangle& _rPlayground) { m_pWin->SetPosSizePixel( _rPlayground.TopLeft(), _rPlayground.GetSize() ); @@ -246,7 +229,6 @@ void OTableDesignView::resizeDocumentView(Rectangle& _rPlayground) _rPlayground.SetSize( Size( 0, 0 ) ); } -//------------------------------------------------------------------------------ long OTableDesignView::PreNotify( NotifyEvent& rNEvt ) { sal_Bool bHandled = sal_False; @@ -264,7 +246,7 @@ long OTableDesignView::PreNotify( NotifyEvent& rNEvt ) return bHandled ? 1L : ODataView::PreNotify(rNEvt); } -// ----------------------------------------------------------------------------- + IClipboardTest* OTableDesignView::getActiveChild() const { IClipboardTest* pTest = NULL; @@ -281,53 +263,53 @@ IClipboardTest* OTableDesignView::getActiveChild() const } return pTest; } -// ----------------------------------------------------------------------------- + sal_Bool OTableDesignView::isCopyAllowed() { IClipboardTest* pTest = getActiveChild(); return pTest && pTest->isCopyAllowed(); } -// ----------------------------------------------------------------------------- + sal_Bool OTableDesignView::isCutAllowed() { IClipboardTest* pTest = getActiveChild(); return pTest && pTest->isCutAllowed(); } -// ----------------------------------------------------------------------------- + sal_Bool OTableDesignView::isPasteAllowed() { IClipboardTest* pTest = getActiveChild(); return pTest && pTest->isPasteAllowed(); } -// ----------------------------------------------------------------------------- + void OTableDesignView::copy() { IClipboardTest* pTest = getActiveChild(); if ( pTest ) pTest->copy(); } -// ----------------------------------------------------------------------------- + void OTableDesignView::cut() { IClipboardTest* pTest = getActiveChild(); if ( pTest ) pTest->cut(); } -// ----------------------------------------------------------------------------- + void OTableDesignView::paste() { IClipboardTest* pTest = getActiveChild(); if ( pTest ) pTest->paste(); } -// ----------------------------------------------------------------------------- + // set the view readonly or not void OTableDesignView::setReadOnly(sal_Bool _bReadOnly) { GetDescWin()->SetReadOnly(_bReadOnly); GetEditorCtrl()->SetReadOnly(_bReadOnly); } -// ----------------------------------------------------------------------------- + void OTableDesignView::reSync() { GetEditorCtrl()->DeactivateCell(); @@ -336,12 +318,11 @@ void OTableDesignView::reSync() if ( pFieldDescr ) GetDescWin()->DisplayData(pFieldDescr); } -// ----------------------------------------------------------------------------- + void OTableDesignView::GetFocus() { if ( GetEditorCtrl() ) GetEditorCtrl()->GrabFocus(); } -// ----------------------------------------------------------------------------- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ui/tabledesign/TableFieldControl.cxx b/dbaccess/source/ui/tabledesign/TableFieldControl.cxx index df118795d9b6..cbca9cbab371 100644 --- a/dbaccess/source/ui/tabledesign/TableFieldControl.cxx +++ b/dbaccess/source/ui/tabledesign/TableFieldControl.cxx @@ -37,19 +37,19 @@ using namespace dbaui; OTableFieldControl::OTableFieldControl( Window* pParent, OTableDesignHelpBar* pHelpBar) :OFieldDescControl(pParent,pHelpBar) { } -//------------------------------------------------------------------ + void OTableFieldControl::CellModified(long nRow, sal_uInt16 nColId ) { GetCtrl()->CellModified(nRow,nColId); } -//------------------------------------------------------------------ + OTableEditorCtrl* OTableFieldControl::GetCtrl() const { OTableDesignView* pDesignWin = static_cast<OTableDesignView*>(GetParent()->GetParent()->GetParent()->GetParent()); OSL_ENSURE(pDesignWin,"no view!"); return pDesignWin->GetEditorCtrl(); } -//------------------------------------------------------------------ + sal_Bool OTableFieldControl::IsReadOnly() { sal_Bool bRead(GetCtrl()->IsReadOnly()); @@ -68,7 +68,7 @@ sal_Bool OTableFieldControl::IsReadOnly() } return bRead; } -//------------------------------------------------------------------ + void OTableFieldControl::ActivateAggregate( EControlType eType ) { switch(eType) @@ -80,7 +80,7 @@ void OTableFieldControl::ActivateAggregate( EControlType eType ) OFieldDescControl::ActivateAggregate(eType); } } -//------------------------------------------------------------------ + void OTableFieldControl::DeactivateAggregate( EControlType eType ) { switch(eType) @@ -92,17 +92,17 @@ void OTableFieldControl::DeactivateAggregate( EControlType eType ) OFieldDescControl::DeactivateAggregate(eType); } } -// ----------------------------------------------------------------------------- + void OTableFieldControl::SetModified(sal_Bool bModified) { GetCtrl()->GetView()->getController().setModified(bModified); } -// ----------------------------------------------------------------------------- + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> OTableFieldControl::getConnection() { return GetCtrl()->GetView()->getController().getConnection(); } -// ----------------------------------------------------------------------------- + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> OTableFieldControl::getMetaData() { Reference<XConnection> xCon = GetCtrl()->GetView()->getController().getConnection(); @@ -110,36 +110,35 @@ void OTableFieldControl::SetModified(sal_Bool bModified) return NULL; return xCon->getMetaData(); } -// ----------------------------------------------------------------------------- + Reference< XNumberFormatter > OTableFieldControl::GetFormatter() const { return GetCtrl()->GetView()->getController().getNumberFormatter(); } -// ----------------------------------------------------------------------------- + TOTypeInfoSP OTableFieldControl::getTypeInfo(sal_Int32 _nPos) { return GetCtrl()->GetView()->getController().getTypeInfo(_nPos); } -// ----------------------------------------------------------------------------- + const OTypeInfoMap* OTableFieldControl::getTypeInfo() const { return const_cast<OTableFieldControl*>(this)->GetCtrl()->GetView()->getController().getTypeInfo(); } -// ----------------------------------------------------------------------------- + Locale OTableFieldControl::GetLocale() const { return const_cast<OTableFieldControl*>(this)->GetCtrl()->GetView()->getLocale(); } -// ----------------------------------------------------------------------------- + sal_Bool OTableFieldControl::isAutoIncrementValueEnabled() const { return const_cast<OTableFieldControl*>(this)->GetCtrl()->GetView()->getController().isAutoIncrementValueEnabled(); } -// ----------------------------------------------------------------------------- + OUString OTableFieldControl::getAutoIncrementValue() const { return const_cast<OTableFieldControl*>(this)->GetCtrl()->GetView()->getController().getAutoIncrementValue(); } -// ----------------------------------------------------------------------------- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ui/tabledesign/TableFieldControl.hxx b/dbaccess/source/ui/tabledesign/TableFieldControl.hxx index e95b5f36c74c..9ff9886eea6a 100644 --- a/dbaccess/source/ui/tabledesign/TableFieldControl.hxx +++ b/dbaccess/source/ui/tabledesign/TableFieldControl.hxx @@ -25,9 +25,7 @@ namespace dbaui { class OTableEditorCtrl; class OTableDesignHelpBar; - //================================================================== // OTableFieldControl - //================================================================== class OTableFieldControl : public OFieldDescControl { OTableEditorCtrl* GetCtrl() const; @@ -59,5 +57,4 @@ namespace dbaui } #endif // DBAUI_TABLEFIELDCONTROL_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx b/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx index 36b53f5e69b4..69ef284025c8 100644 --- a/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx +++ b/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - #include "TableFieldDescWin.hxx" #include <osl/diagnose.h> #include "FieldDescriptions.hxx" @@ -43,24 +42,18 @@ #define DETAILS_MIN_HELP_HEIGHT 50 #define DETAILS_OPT_HELP_HEIGHT 100 - using namespace dbaui; -//================================================================== // class OTableFieldDescWin -//================================================================== DBG_NAME(OTableFieldDescWin) -//------------------------------------------------------------------------------ OTableFieldDescWin::OTableFieldDescWin( Window* pParent) :TabPage(pParent, WB_3DLOOK) { DBG_CTOR(OTableFieldDescWin,NULL); - ////////////////////////////////////////////////////////////////////// // Header m_pHeader = new FixedText( this, WB_CENTER | WB_INFO ); // | WB_3DLOOK m_pHeader->SetText( String(ModuleRes(STR_TAB_PROPERTIES)) ); m_pHeader->Show(); - ////////////////////////////////////////////////////////////////////// // HelpBar m_pHelpBar = new OTableDesignHelpBar( this ); m_pHelpBar->SetHelpId(HID_TAB_DESIGN_HELP_TEXT_FRAME); @@ -71,11 +64,9 @@ OTableFieldDescWin::OTableFieldDescWin( Window* pParent) getGenPage()->Show(); } -//------------------------------------------------------------------------------ OTableFieldDescWin::~OTableFieldDescWin() { DBG_DTOR(OTableFieldDescWin,NULL); - ////////////////////////////////////////////////////////////////////// // Children zerstoeren m_pHelpBar->Hide(); getGenPage()->Hide(); @@ -101,57 +92,48 @@ OTableFieldDescWin::~OTableFieldDescWin() } } -//------------------------------------------------------------------------------ void OTableFieldDescWin::Init() { OSL_ENSURE(getGenPage() != NULL, "OTableFieldDescWin::Init : ups ... no GenericPage ... this will crash ..."); getGenPage()->Init(); } -//------------------------------------------------------------------------------ void OTableFieldDescWin::SetReadOnly( sal_Bool bRead ) { DBG_CHKTHIS(OTableFieldDescWin,NULL); getGenPage()->SetReadOnly( bRead ); } -//------------------------------------------------------------------------------ void OTableFieldDescWin::DisplayData( OFieldDescription* pFieldDescr ) { DBG_CHKTHIS(OTableFieldDescWin,NULL); getGenPage()->DisplayData( pFieldDescr ); } -//------------------------------------------------------------------------------ void OTableFieldDescWin::SaveData( OFieldDescription* pFieldDescr ) { DBG_CHKTHIS(OTableFieldDescWin,NULL); getGenPage()->SaveData( pFieldDescr ); } -//------------------------------------------------------------------------------ void OTableFieldDescWin::Paint( const Rectangle& /*rRect*/ ) { DBG_CHKTHIS(OTableFieldDescWin,NULL); - ////////////////////////////////////////////////////////////////////// // 3D-Linie am oberen Fensterrand const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); SetLineColor( rStyleSettings.GetLightColor() ); DrawLine( Point(0,0), Point(GetSizePixel().Width(),0) ); - ////////////////////////////////////////////////////////////////////// // 3D-Linie zum Abtrennen des Headers DrawLine( Point(3, DETAILS_HEADER_HEIGHT), Point(GetSizePixel().Width()-6, DETAILS_HEADER_HEIGHT) ); SetLineColor( rStyleSettings.GetShadowColor() ); DrawLine( Point(3, DETAILS_HEADER_HEIGHT-1), Point(GetSizePixel().Width()-6, DETAILS_HEADER_HEIGHT-1) ); } -//------------------------------------------------------------------------------ void OTableFieldDescWin::Resize() { DBG_CHKTHIS(OTableFieldDescWin,NULL); - ////////////////////////////////////////////////////////////////////// // Abmessungen parent window Size aOutputSize( GetOutputSizePixel() ); long nOutputWidth = aOutputSize.Width(); @@ -233,7 +215,7 @@ void OTableFieldDescWin::Resize() } Invalidate(); } -// ----------------------------------------------------------------------------- + IClipboardTest* OTableFieldDescWin::getActiveChild() const { IClipboardTest* pTest = NULL; @@ -248,52 +230,52 @@ IClipboardTest* OTableFieldDescWin::getActiveChild() const } return pTest; } -// ----------------------------------------------------------------------------- + sal_Bool OTableFieldDescWin::isCopyAllowed() { return getActiveChild() && getActiveChild()->isCopyAllowed(); } -// ----------------------------------------------------------------------------- + sal_Bool OTableFieldDescWin::isCutAllowed() { return (getGenPage() && getGenPage()->HasChildPathFocus() && getGenPage()->isCutAllowed()); } -// ----------------------------------------------------------------------------- + sal_Bool OTableFieldDescWin::isPasteAllowed() { return (getGenPage() && getGenPage()->HasChildPathFocus() && getGenPage()->isPasteAllowed()); } -// ----------------------------------------------------------------------------- + void OTableFieldDescWin::cut() { if ( getGenPage() && getGenPage()->HasChildPathFocus() ) getGenPage()->cut(); } -// ----------------------------------------------------------------------------- + void OTableFieldDescWin::copy() { if ( getActiveChild() ) getActiveChild()->copy(); } -// ----------------------------------------------------------------------------- + void OTableFieldDescWin::paste() { if ( getGenPage() && getGenPage()->HasChildPathFocus() ) getGenPage()->paste(); } -// ----------------------------------------------------------------------------- + void OTableFieldDescWin::GetFocus() { if ( getGenPage() ) getGenPage()->GetFocus(); } -// ----------------------------------------------------------------------------- + void OTableFieldDescWin::LoseFocus() { if ( getGenPage() ) getGenPage()->LoseFocus(); } -// ----------------------------------------------------------------------------- + long OTableFieldDescWin::PreNotify( NotifyEvent& rNEvt ) { sal_Bool bHandled = sal_False; diff --git a/dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx b/dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx index b1ef635e04af..ce03198fea23 100644 --- a/dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx +++ b/dbaccess/source/ui/tabledesign/TableFieldDescWin.hxx @@ -29,7 +29,6 @@ namespace dbaui class OFieldDescGenWin; class OTableDesignHelpBar; class OFieldDescription; - //================================================================== // Ableitung von TabPage ist ein Trick von TH, // um Aenderungen der Systemfarben zu bemerken class OTableFieldDescWin : public TabPage @@ -96,7 +95,4 @@ namespace dbaui } #endif // DBAUI_TABLEFIELDDESCRIPTION_HXX - - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ui/tabledesign/TableRow.cxx b/dbaccess/source/ui/tabledesign/TableRow.cxx index fc2ee354d1f5..9546e7b0ed3b 100644 --- a/dbaccess/source/ui/tabledesign/TableRow.cxx +++ b/dbaccess/source/ui/tabledesign/TableRow.cxx @@ -29,11 +29,8 @@ using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; -//======================================================================== // class OTableRow -//======================================================================== DBG_NAME(OTableRow) -//------------------------------------------------------------------------------ OTableRow::OTableRow() :m_pActFieldDescr( NULL ) ,m_nPos( -1 ) @@ -42,7 +39,7 @@ OTableRow::OTableRow() { DBG_CTOR(OTableRow,NULL); } -//------------------------------------------------------------------------------ + OTableRow::OTableRow(const Reference< XPropertySet >& xAffectedCol) :m_pActFieldDescr( NULL ) ,m_nPos( -1 ) @@ -52,7 +49,7 @@ OTableRow::OTableRow(const Reference< XPropertySet >& xAffectedCol) DBG_CTOR(OTableRow,NULL); m_pActFieldDescr = new OFieldDescription(xAffectedCol); } -//------------------------------------------------------------------------------ + OTableRow::OTableRow( const OTableRow& rRow, long nPosition ) :m_pActFieldDescr(NULL) ,m_nPos( nPosition ) @@ -69,7 +66,6 @@ OTableRow::OTableRow( const OTableRow& rRow, long nPosition ) } } -//------------------------------------------------------------------------------ OTableRow::~OTableRow() { DBG_DTOR(OTableRow,NULL); @@ -77,20 +73,19 @@ OTableRow::~OTableRow() delete m_pActFieldDescr; } -//------------------------------------------------------------------------------ void OTableRow::SetPrimaryKey( sal_Bool bSet ) { DBG_CHKTHIS(OTableRow,NULL); if(m_pActFieldDescr) m_pActFieldDescr->SetPrimaryKey(bSet); } -// ----------------------------------------------------------------------------- + sal_Bool OTableRow::IsPrimaryKey() const { DBG_CHKTHIS(OTableRow,NULL); return m_pActFieldDescr && m_pActFieldDescr->IsPrimaryKey(); } -// ----------------------------------------------------------------------------- + void OTableRow::SetFieldType( const TOTypeInfoSP& _pType, sal_Bool _bForce ) { DBG_CHKTHIS(OTableRow,NULL); @@ -109,10 +104,9 @@ void OTableRow::SetFieldType( const TOTypeInfoSP& _pType, sal_Bool _bForce ) m_pActFieldDescr = NULL; } } -// ----------------------------------------------------------------------------- + namespace dbaui { - // ----------------------------------------------------------------------------- SvStream& operator<<( SvStream& _rStr, const OTableRow& _rRow ) { _rStr << _rRow.m_nPos; @@ -151,7 +145,6 @@ namespace dbaui _rStr << (sal_Int32)0; return _rStr; } - // ----------------------------------------------------------------------------- SvStream& operator>>( SvStream& _rStr, OTableRow& _rRow ) { _rStr >> _rRow.m_nPos; @@ -188,7 +181,6 @@ namespace dbaui pFieldDesc->SetControlDefault(aControlDefault); - _rStr >> nValue; pFieldDesc->SetTypeValue(nValue); @@ -212,7 +204,6 @@ namespace dbaui } return _rStr; } - // ----------------------------------------------------------------------------- } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ui/tabledesign/TableRowExchange.cxx b/dbaccess/source/ui/tabledesign/TableRowExchange.cxx index 810ae3283a83..3a14971d7dc3 100644 --- a/dbaccess/source/ui/tabledesign/TableRowExchange.cxx +++ b/dbaccess/source/ui/tabledesign/TableRowExchange.cxx @@ -30,7 +30,6 @@ namespace dbaui : m_vTableRow(_rvTableRow) { } - // ----------------------------------------------------------------------------- sal_Bool OTableRowExchange::WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& /*rFlavor*/ ) { if(nUserObjectId == SOT_FORMATSTR_ID_SBA_TABED) @@ -48,13 +47,11 @@ namespace dbaui } return sal_False; } - // ----------------------------------------------------------------------------- void OTableRowExchange::AddSupportedFormats() { if ( !m_vTableRow.empty() ) AddFormat(SOT_FORMATSTR_ID_SBA_TABED); } - // ----------------------------------------------------------------------------- sal_Bool OTableRowExchange::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) { sal_uLong nFormat = SotExchange::GetFormat(rFlavor); @@ -62,12 +59,10 @@ namespace dbaui return SetObject(&m_vTableRow,SOT_FORMATSTR_ID_SBA_TABED,rFlavor); return sal_False; } - // ----------------------------------------------------------------------------- void OTableRowExchange::ObjectReleased() { m_vTableRow.clear(); } - // ----------------------------------------------------------------------------- } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ui/tabledesign/TableUndo.cxx b/dbaccess/source/ui/tabledesign/TableUndo.cxx index 68d97e3deaa0..5445f1c6ff9d 100644 --- a/dbaccess/source/ui/tabledesign/TableUndo.cxx +++ b/dbaccess/source/ui/tabledesign/TableUndo.cxx @@ -40,9 +40,7 @@ TYPEINIT1( OTableEditorInsUndoAct, OTableEditorUndoAct ); TYPEINIT1( OTableEditorInsNewUndoAct, OTableEditorUndoAct ); TYPEINIT1( OPrimKeyUndoAct, OTableEditorUndoAct ); -//============================================================================== // class OTableDesignUndoAct -//============================================================================== DBG_NAME(OTableDesignUndoAct); OTableDesignUndoAct::OTableDesignUndoAct( OTableRowView* pOwner,sal_uInt16 nCommentID ) : OCommentUndoAction(nCommentID) ,m_pTabDgnCtrl( pOwner ) @@ -51,18 +49,15 @@ OTableDesignUndoAct::OTableDesignUndoAct( OTableRowView* pOwner,sal_uInt16 nComm m_pTabDgnCtrl->m_nCurUndoActId++; } -//------------------------------------------------------------------------- OTableDesignUndoAct::~OTableDesignUndoAct() { DBG_DTOR(OTableDesignUndoAct,NULL); } -//------------------------------------------------------------------------- void OTableDesignUndoAct::Undo() { m_pTabDgnCtrl->m_nCurUndoActId--; - ////////////////////////////////////////////////////////////////////// // doc has not been modified if first undo was reverted if( m_pTabDgnCtrl->m_nCurUndoActId == 0 ) { @@ -71,12 +66,10 @@ void OTableDesignUndoAct::Undo() } } -//------------------------------------------------------------------------- void OTableDesignUndoAct::Redo() { m_pTabDgnCtrl->m_nCurUndoActId++; - ////////////////////////////////////////////////////////////////////// // restore Modifed-flag after Redo of first Undo-action if( m_pTabDgnCtrl->m_nCurUndoActId > 0 ) { @@ -84,9 +77,8 @@ void OTableDesignUndoAct::Redo() m_pTabDgnCtrl->GetView()->getController().InvalidateFeature(SID_SAVEDOC); } } -//============================================================================== + // class OTableDesignCellUndoAct -//============================================================================== DBG_NAME(OTableDesignCellUndoAct); OTableDesignCellUndoAct::OTableDesignCellUndoAct( OTableRowView* pOwner, long nRowID, sal_uInt16 nColumn ) : OTableDesignUndoAct( pOwner ,STR_TABED_UNDO_CELLMODIFIED) @@ -94,26 +86,21 @@ OTableDesignCellUndoAct::OTableDesignCellUndoAct( OTableRowView* pOwner, long nR ,m_nRow( nRowID ) { DBG_CTOR(OTableDesignCellUndoAct,NULL); - ////////////////////////////////////////////////////////////////////// // read text at position (m_nRow, m_nCol) m_sOldText = m_pTabDgnCtrl->GetCellData( m_nRow, m_nCol ); } -//------------------------------------------------------------------------- OTableDesignCellUndoAct::~OTableDesignCellUndoAct() { DBG_DTOR(OTableDesignCellUndoAct,NULL); } -//------------------------------------------------------------------------- void OTableDesignCellUndoAct::Undo() { - ////////////////////////////////////////////////////////////////////// // store text at old line and restore the old one m_pTabDgnCtrl->ActivateCell( m_nRow, m_nCol ); m_sNewText = m_pTabDgnCtrl->GetCellData( m_nRow, m_nCol ); m_pTabDgnCtrl->SetCellData( m_nRow, m_nCol, m_sOldText ); - ////////////////////////////////////////////////////////////////////// // line has not been modified if the first Undo was reverted if (m_pTabDgnCtrl->GetCurUndoActId() == 1) { @@ -127,10 +114,8 @@ void OTableDesignCellUndoAct::Undo() OTableDesignUndoAct::Undo(); } -//------------------------------------------------------------------------- void OTableDesignCellUndoAct::Redo() { - ////////////////////////////////////////////////////////////////////// // restore new text m_pTabDgnCtrl->ActivateCell( m_nRow, m_nCol ); m_pTabDgnCtrl->SetCellData( m_nRow, m_nCol, m_sNewText ); @@ -138,9 +123,7 @@ void OTableDesignCellUndoAct::Redo() OTableDesignUndoAct::Redo(); } -//============================================================================== // class OTableEditorUndoAct -//============================================================================== DBG_NAME(OTableEditorUndoAct); OTableEditorUndoAct::OTableEditorUndoAct( OTableEditorCtrl* pOwner,sal_uInt16 _nCommentID ) : OTableDesignUndoAct( pOwner ,_nCommentID) @@ -149,15 +132,12 @@ OTableEditorUndoAct::OTableEditorUndoAct( OTableEditorCtrl* pOwner,sal_uInt16 _n DBG_CTOR(OTableEditorUndoAct,NULL); } -//------------------------------------------------------------------------- OTableEditorUndoAct::~OTableEditorUndoAct() { DBG_DTOR(OTableEditorUndoAct,NULL); } -//============================================================================== // class OTableEditorTypeSelUndoAct -//============================================================================== DBG_NAME(OTableEditorTypeSelUndoAct); OTableEditorTypeSelUndoAct::OTableEditorTypeSelUndoAct( OTableEditorCtrl* pOwner, long nRowID, sal_uInt16 nColumn, const TOTypeInfoSP& _pOldType ) :OTableEditorUndoAct( pOwner ,STR_TABED_UNDO_TYPE_CHANGED) @@ -168,16 +148,13 @@ OTableEditorTypeSelUndoAct::OTableEditorTypeSelUndoAct( OTableEditorCtrl* pOwner DBG_CTOR(OTableEditorTypeSelUndoAct,NULL); } -//------------------------------------------------------------------------- OTableEditorTypeSelUndoAct::~OTableEditorTypeSelUndoAct() { DBG_DTOR(OTableEditorTypeSelUndoAct,NULL); } -//------------------------------------------------------------------------- void OTableEditorTypeSelUndoAct::Undo() { - ////////////////////////////////////////////////////////////////////// // restore type OFieldDescription* pFieldDesc = pTabEdCtrl->GetFieldDescr(m_nRow); if(pFieldDesc) @@ -190,10 +167,8 @@ void OTableEditorTypeSelUndoAct::Undo() OTableEditorUndoAct::Undo(); } -//------------------------------------------------------------------------- void OTableEditorTypeSelUndoAct::Redo() { - ////////////////////////////////////////////////////////////////////// // new type pTabEdCtrl->GoToRowColumnId( m_nRow ,m_nCol); pTabEdCtrl->SetCellData(m_nRow,m_nCol,m_pNewType); @@ -201,15 +176,12 @@ void OTableEditorTypeSelUndoAct::Redo() OTableEditorUndoAct::Redo(); } -//============================================================================== // class OTableEditorDelUndoAct -//============================================================================== DBG_NAME(OTableEditorDelUndoAct); OTableEditorDelUndoAct::OTableEditorDelUndoAct( OTableEditorCtrl* pOwner) : OTableEditorUndoAct( pOwner ,STR_TABED_UNDO_ROWDELETED) { DBG_CTOR(OTableEditorDelUndoAct,NULL); - ////////////////////////////////////////////////////////////////////// // fill DeletedRowList ::std::vector< ::boost::shared_ptr<OTableRow> >* pOriginalRows = pOwner->GetRowList(); long nIndex = pOwner->FirstSelectedRow(); @@ -226,17 +198,14 @@ OTableEditorDelUndoAct::OTableEditorDelUndoAct( OTableEditorCtrl* pOwner) : } } -//------------------------------------------------------------------------- OTableEditorDelUndoAct::~OTableEditorDelUndoAct() { DBG_DTOR(OTableEditorDelUndoAct,NULL); m_aDeletedRows.clear(); } -//------------------------------------------------------------------------- void OTableEditorDelUndoAct::Undo() { - ////////////////////////////////////////////////////////////////////// // Insert the deleted line sal_uLong nPos; ::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aIter = m_aDeletedRows.begin(); @@ -257,10 +226,8 @@ void OTableEditorDelUndoAct::Undo() OTableEditorUndoAct::Undo(); } -//------------------------------------------------------------------------- void OTableEditorDelUndoAct::Redo() { - ////////////////////////////////////////////////////////////////////// // delete line again sal_uLong nPos; ::std::vector< ::boost::shared_ptr<OTableRow> >::iterator aIter = m_aDeletedRows.begin(); @@ -278,10 +245,7 @@ void OTableEditorDelUndoAct::Redo() OTableEditorUndoAct::Redo(); } -//------------------------------------------------------------------------- -//============================================================================== // class OTableEditorInsUndoAct -//============================================================================== DBG_NAME(OTableEditorInsUndoAct); OTableEditorInsUndoAct::OTableEditorInsUndoAct( OTableEditorCtrl* pOwner, long nInsertPosition , @@ -293,17 +257,14 @@ OTableEditorInsUndoAct::OTableEditorInsUndoAct( OTableEditorCtrl* pOwner, DBG_CTOR(OTableEditorInsUndoAct,NULL); } -//------------------------------------------------------------------------- OTableEditorInsUndoAct::~OTableEditorInsUndoAct() { DBG_DTOR(OTableEditorInsUndoAct,NULL); m_vInsertedRows.clear(); } -//------------------------------------------------------------------------- void OTableEditorInsUndoAct::Undo() { - ////////////////////////////////////////////////////////////////////// // delete lines again ::std::vector< ::boost::shared_ptr<OTableRow> >* pOriginalRows = pTabEdCtrl->GetRowList(); for( long i=(m_nInsPos+m_vInsertedRows.size()-1); i>(m_nInsPos-1); i-- ) @@ -317,10 +278,8 @@ void OTableEditorInsUndoAct::Undo() OTableEditorUndoAct::Undo(); } -//------------------------------------------------------------------------- void OTableEditorInsUndoAct::Redo() { - ////////////////////////////////////////////////////////////////////// // insert lines again long nInsertRow = m_nInsPos; ::boost::shared_ptr<OTableRow> pRow; @@ -340,9 +299,7 @@ void OTableEditorInsUndoAct::Redo() OTableEditorUndoAct::Redo(); } -//============================================================================== // class OTableEditorInsNewUndoAct -//============================================================================== DBG_NAME(OTableEditorInsNewUndoAct); OTableEditorInsNewUndoAct::OTableEditorInsNewUndoAct( OTableEditorCtrl* pOwner, long nInsertPosition, long nInsertedRows ) : OTableEditorUndoAct( pOwner ,STR_TABED_UNDO_NEWROWINSERTED) @@ -352,16 +309,13 @@ OTableEditorInsNewUndoAct::OTableEditorInsNewUndoAct( OTableEditorCtrl* pOwner, DBG_CTOR(OTableEditorInsNewUndoAct,NULL); } -//------------------------------------------------------------------------- OTableEditorInsNewUndoAct::~OTableEditorInsNewUndoAct() { DBG_DTOR(OTableEditorInsNewUndoAct,NULL); } -//------------------------------------------------------------------------- void OTableEditorInsNewUndoAct::Undo() { - ////////////////////////////////////////////////////////////////////// // delete inserted lines ::std::vector< ::boost::shared_ptr<OTableRow> >* pOriginalRows = pTabEdCtrl->GetRowList(); @@ -376,10 +330,8 @@ void OTableEditorInsNewUndoAct::Undo() OTableEditorUndoAct::Undo(); } -//------------------------------------------------------------------------- void OTableEditorInsNewUndoAct::Redo() { - ////////////////////////////////////////////////////////////////////// // insert lines again ::std::vector< ::boost::shared_ptr<OTableRow> >* pRowList = pTabEdCtrl->GetRowList(); @@ -392,12 +344,8 @@ void OTableEditorInsNewUndoAct::Redo() OTableEditorUndoAct::Redo(); } -//------------------------------------------------------------------------- -//======================================================================== // class OPrimKeyUndoAct -//======================================================================== DBG_NAME(OPrimKeyUndoAct); -//------------------------------------------------------------------------- OPrimKeyUndoAct::OPrimKeyUndoAct( OTableEditorCtrl* pOwner, MultiSelection aDeletedKeys, MultiSelection aInsertedKeys) : OTableEditorUndoAct( pOwner ,STR_TABLEDESIGN_UNDO_PRIMKEY) ,m_aDelKeys( aDeletedKeys ) @@ -407,20 +355,17 @@ OPrimKeyUndoAct::OPrimKeyUndoAct( OTableEditorCtrl* pOwner, MultiSelection aDele DBG_CTOR(OPrimKeyUndoAct,NULL); } -//------------------------------------------------------------------------- OPrimKeyUndoAct::~OPrimKeyUndoAct() { DBG_DTOR(OPrimKeyUndoAct,NULL); } -//------------------------------------------------------------------------- void OPrimKeyUndoAct::Undo() { ::std::vector< ::boost::shared_ptr<OTableRow> >* pRowList = pTabEdCtrl->GetRowList(); ::boost::shared_ptr<OTableRow> pRow; long nIndex; - ////////////////////////////////////////////////////////////////////// // delete inserted keys for( nIndex = m_aInsKeys.FirstSelected(); nIndex != (long)SFX_ENDOFSELECTION; nIndex=m_aInsKeys.NextSelected() ) { @@ -429,7 +374,6 @@ void OPrimKeyUndoAct::Undo() pRow->SetPrimaryKey( sal_False ); } - ////////////////////////////////////////////////////////////////////// // restore deleted keys for( nIndex = m_aDelKeys.FirstSelected(); nIndex != (long)SFX_ENDOFSELECTION; nIndex=m_aDelKeys.NextSelected() ) { @@ -442,18 +386,15 @@ void OPrimKeyUndoAct::Undo() OTableEditorUndoAct::Undo(); } -//------------------------------------------------------------------------- void OPrimKeyUndoAct::Redo() { ::std::vector< ::boost::shared_ptr<OTableRow> >* pRowList = pTabEdCtrl->GetRowList(); long nIndex; - ////////////////////////////////////////////////////////////////////// // delete the deleted keys for( nIndex = m_aDelKeys.FirstSelected(); nIndex != (long)SFX_ENDOFSELECTION; nIndex=m_aDelKeys.NextSelected() ) (*pRowList)[nIndex]->SetPrimaryKey( sal_False ); - ////////////////////////////////////////////////////////////////////// // restore the inserted keys for( nIndex = m_aInsKeys.FirstSelected(); nIndex != (long)SFX_ENDOFSELECTION; nIndex=m_aInsKeys.NextSelected() ) (*pRowList)[nIndex]->SetPrimaryKey( sal_True ); diff --git a/dbaccess/source/ui/tabledesign/TableUndo.hxx b/dbaccess/source/ui/tabledesign/TableUndo.hxx index 71911d9085e2..41fa42ebc2fb 100644 --- a/dbaccess/source/ui/tabledesign/TableUndo.hxx +++ b/dbaccess/source/ui/tabledesign/TableUndo.hxx @@ -29,7 +29,6 @@ namespace dbaui { - //======================================================================== class OTableRowView; class OTableRow; class OTableDesignUndoAct : public OCommentUndoAction @@ -45,7 +44,6 @@ namespace dbaui virtual ~OTableDesignUndoAct(); }; - //======================================================================== class OTableEditorCtrl; class OTableEditorUndoAct : public OTableDesignUndoAct { @@ -58,8 +56,6 @@ namespace dbaui virtual ~OTableEditorUndoAct(); }; - - //======================================================================== class OTableDesignCellUndoAct : public OTableDesignUndoAct { protected: @@ -76,7 +72,6 @@ namespace dbaui virtual ~OTableDesignCellUndoAct(); }; - //======================================================================== class OTableEditorTypeSelUndoAct : public OTableEditorUndoAct { protected: @@ -93,7 +88,6 @@ namespace dbaui virtual ~OTableEditorTypeSelUndoAct(); }; - //======================================================================== class OTableEditorDelUndoAct : public OTableEditorUndoAct { protected: @@ -107,7 +101,6 @@ namespace dbaui virtual ~OTableEditorDelUndoAct(); }; - //======================================================================== class OTableEditorInsUndoAct : public OTableEditorUndoAct { protected: @@ -124,7 +117,6 @@ namespace dbaui virtual ~OTableEditorInsUndoAct(); }; - //======================================================================== class OTableEditorInsNewUndoAct : public OTableEditorUndoAct { protected: @@ -139,7 +131,6 @@ namespace dbaui virtual ~OTableEditorInsNewUndoAct(); }; - //======================================================================== class OPrimKeyUndoAct : public OTableEditorUndoAct { protected: @@ -158,5 +149,4 @@ namespace dbaui } #endif // DBAUI_TABLEUNDO_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |