diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-10-05 19:37:05 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-10-07 17:55:05 +0200 |
commit | aff306cdd05a7be14c6dd2a6826cc61d38463465 (patch) | |
tree | f64fff1e99941bd16886c6a4260ef06a3e4e0523 /svtools | |
parent | c8467eb5b75ba7de19403f24b92907c77ce4f077 (diff) |
SvSimpleTableContainer is now unused
Change-Id: I7762d95290a0b35de4f909895a4e28b52c436ed9
Reviewed-on: https://gerrit.libreoffice.org/80307
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/Library_svt.mk | 2 | ||||
-rw-r--r-- | svtools/inc/uitest/uiobject.hxx | 32 | ||||
-rw-r--r-- | svtools/source/contnr/simptabl.cxx | 402 | ||||
-rw-r--r-- | svtools/source/uitest/uiobject.cxx | 51 |
4 files changed, 0 insertions, 487 deletions
diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk index 5eefaf54d144..6b0c994041c0 100644 --- a/svtools/Library_svt.mk +++ b/svtools/Library_svt.mk @@ -89,7 +89,6 @@ $(eval $(call gb_Library_add_exception_objects,svt,\ svtools/source/config/printoptions \ svtools/source/contnr/DocumentInfoPreview \ svtools/source/contnr/querydelete \ - svtools/source/contnr/simptabl \ svtools/source/contnr/templwin \ svtools/source/control/accessibleruler \ svtools/source/control/asynclink \ @@ -168,7 +167,6 @@ $(eval $(call gb_Library_add_exception_objects,svt,\ svtools/source/table/mousefunction \ svtools/source/table/cellvalueconversion \ svtools/source/table/tablegeometry \ - svtools/source/uitest/uiobject \ svtools/source/uno/addrtempuno \ svtools/source/uno/fpicker \ svtools/source/uno/framestatuslistener \ diff --git a/svtools/inc/uitest/uiobject.hxx b/svtools/inc/uitest/uiobject.hxx deleted file mode 100644 index c22e2e409346..000000000000 --- a/svtools/inc/uitest/uiobject.hxx +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#include <memory> -#include <svtools/simptabl.hxx> -#include <vcl/uitest/uiobject.hxx> - -class SvSimpleTable; - -class SimpleTableUIObject : public TreeListUIObject -{ -public: - SimpleTableUIObject(const VclPtr<SvSimpleTable>& xTable); - - virtual StringMap get_state() override; - - static std::unique_ptr<UIObject> createFromContainer(vcl::Window* pWindow); - -protected: - virtual OUString get_type() const override; - -private: - VclPtr<SvSimpleTable> mxTable; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/simptabl.cxx b/svtools/source/contnr/simptabl.cxx deleted file mode 100644 index a74cde258b51..000000000000 --- a/svtools/source/contnr/simptabl.cxx +++ /dev/null @@ -1,402 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <svtools/simptabl.hxx> -#include <unotools/intlwrapper.hxx> -#include <vcl/svlbitm.hxx> -#include <vcl/treelistentry.hxx> -#include <vcl/builderfactory.hxx> -#include <vcl/event.hxx> -#include <uitest/uiobject.hxx> - -SvSimpleTableContainer::SvSimpleTableContainer(vcl::Window* pParent, WinBits nBits) - : Control(pParent, nBits) - , m_pTable(nullptr) -{ -} - -SvSimpleTableContainer::~SvSimpleTableContainer() -{ - disposeOnce(); -} - -void SvSimpleTableContainer::dispose() -{ - m_pTable.clear(); - Control::dispose(); -} - -VCL_BUILDER_FACTORY_ARGS(SvSimpleTableContainer, - WB_TABSTOP | WB_DIALOGCONTROL | WB_BORDER) - -void SvSimpleTableContainer::SetTable(SvSimpleTable* pTable) -{ - m_pTable = pTable; -} - -SvSimpleTable* SvSimpleTableContainer::GetTable() -{ - return m_pTable.get(); -} - -bool SvSimpleTableContainer::PreNotify( NotifyEvent& rNEvt ) -{ - bool bResult = true; - if ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT ) - { - const vcl::KeyCode& aKeyCode = rNEvt.GetKeyEvent()->GetKeyCode(); - sal_uInt16 nKey = aKeyCode.GetCode(); - if (nKey == KEY_TAB) - GetParent()->EventNotify( rNEvt ); - else if (m_pTable && m_pTable->IsFocusOnCellEnabled() && ( nKey == KEY_LEFT || nKey == KEY_RIGHT)) - return false; - else - bResult = Control::PreNotify( rNEvt ); - } - else - bResult = Control::PreNotify( rNEvt ); - - return bResult; -} - -void SvSimpleTableContainer::Resize() -{ - Control::Resize(); - if (m_pTable) - m_pTable->UpdateViewSize(); -} - -void SvSimpleTableContainer::GetFocus() -{ - Control::GetFocus(); - if (m_pTable) - m_pTable->GrabFocus(); -} - -FactoryFunction SvSimpleTableContainer::GetUITestFactory() const -{ - return SimpleTableUIObject::createFromContainer; -} - -// SvSimpleTable ------------------------------------------------------------ - -SvSimpleTable::SvSimpleTable(SvSimpleTableContainer& rParent, WinBits nBits): - SvHeaderTabListBox(&rParent, nBits | WB_CLIPCHILDREN | WB_HSCROLL | WB_TABSTOP), - m_rParentTableContainer(rParent), - aHeaderBar(VclPtr<HeaderBar>::Create(&rParent,WB_BUTTONSTYLE | WB_BORDER | WB_TABSTOP)), - bPaintFlag(true), - aCollator(*(IntlWrapper(SvtSysLocale().GetUILanguageTag()).getCaseCollator())) -{ - m_rParentTableContainer.SetTable(this); - - bSortDirection = true; - nSortCol = 0xFFFF; - nOldPos = 0; - - aHeaderBar->SetStartDragHdl(LINK( this, SvSimpleTable, StartDragHdl)); - aHeaderBar->SetDragHdl(LINK( this, SvSimpleTable, DragHdl)); - aHeaderBar->SetEndDragHdl(LINK( this, SvSimpleTable, EndDragHdl)); - aHeaderBar->SetSelectHdl(LINK( this, SvSimpleTable, HeaderBarClick)); - - - EnableCellFocus(); - DisableTransientChildren(); - InitHeaderBar( aHeaderBar ); - - UpdateViewSize(); - - aHeaderBar->Show(); - SvHeaderTabListBox::Show(); -} - -SvSimpleTable::~SvSimpleTable() -{ - disposeOnce(); -} - -void SvSimpleTable::dispose() -{ - m_rParentTableContainer.SetTable(nullptr); - aHeaderBar.disposeAndClear(); - SvHeaderTabListBox::dispose(); -} - -void SvSimpleTable::UpdateViewSize() -{ - Size theWinSize=m_rParentTableContainer.GetOutputSizePixel(); - Size HbSize=aHeaderBar->GetSizePixel(); - - HbSize.setWidth(theWinSize.Width() ); - theWinSize.AdjustHeight(-HbSize.Height()); - Point thePos(0,0); - - aHeaderBar->SetPosPixel(thePos); - aHeaderBar->SetSizePixel(HbSize); - - thePos.AdjustY(HbSize.Height()); - SvHeaderTabListBox::SetPosPixel(thePos); - SvHeaderTabListBox::SetSizePixel(theWinSize); - Invalidate(); -} - -void SvSimpleTable::NotifyScrolled() -{ - long nOffset=-GetXOffset(); - if(nOldPos!=nOffset) - { - aHeaderBar->SetOffset(nOffset); - aHeaderBar->Invalidate(); - aHeaderBar->Update(); - nOldPos=nOffset; - } - SvHeaderTabListBox::NotifyScrolled(); -} - -void SvSimpleTable::SetTabs() -{ - SvHeaderTabListBox::SetTabs(); - - sal_uInt16 nPrivTabCount = TabCount(); - if ( !nPrivTabCount ) - return; - - if ( nPrivTabCount > aHeaderBar->GetItemCount() ) - nPrivTabCount = aHeaderBar->GetItemCount(); - - sal_uInt16 i, nPos = 0; - for ( i = 1; i < nPrivTabCount; ++i ) - { - sal_uInt16 nNewSize = static_cast< sal_uInt16 >( GetTab(i) ) - nPos; - aHeaderBar->SetItemSize( i, nNewSize ); - nPos = static_cast<sal_uInt16>(GetTab(i)); - } - - aHeaderBar->SetItemSize( i, HEADERBAR_FULLSIZE ); // because no tab for last entry -} - -void SvSimpleTable::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) -{ - SvHeaderTabListBox::Paint(rRenderContext, rRect); - - sal_uInt16 nPrivTabCount = TabCount(); - - long nOffset =- GetXOffset(); - nOldPos = nOffset; - - aHeaderBar->SetOffset(nOffset); - aHeaderBar->Invalidate(); - - if (nPrivTabCount && bPaintFlag) - { - if (nPrivTabCount>aHeaderBar->GetItemCount()) - nPrivTabCount=aHeaderBar->GetItemCount(); - - sal_uInt16 nPos = 0; - for (sal_uInt16 i = 1; i < nPrivTabCount; i++) - { - sal_uInt16 nNewSize = static_cast<sal_uInt16>(GetTab(i)) - nPos; - aHeaderBar->SetItemSize(i, nNewSize); - nPos = static_cast<sal_uInt16>(GetTab(i)); - } - } - bPaintFlag = true; -} - -void SvSimpleTable::SortByCol(sal_uInt16 nCol, bool bDir) -{ - if(nSortCol!=0xFFFF) - aHeaderBar->SetItemBits(nSortCol+1,HeaderBarItemBits::STDSTYLE); - - if (nCol != 0xFFFF) - { - if(bDir || nSortCol != nCol) - { - aHeaderBar->SetItemBits( nCol+1, HeaderBarItemBits::STDSTYLE | HeaderBarItemBits::DOWNARROW); - GetModel()->SetSortMode(SortAscending); - bDir = true; - } - else - { - aHeaderBar->SetItemBits( nCol+1, HeaderBarItemBits::STDSTYLE | HeaderBarItemBits::UPARROW); - GetModel()->SetSortMode(SortDescending); - } - - GetModel()->SetCompareHdl( LINK( this, SvSimpleTable, CompareHdl)); - - if(nSortCol == nCol) - { - GetModel()->Reverse(); - Resize(); //update rows - } - else - { - nSortCol=nCol; - GetModel()->Resort(); - } - } - else - GetModel()->SetSortMode(SortNone); - nSortCol=nCol; - bSortDirection=bDir; - SetAlternatingRowColors( true ); -} - -void SvSimpleTable::HBarClick() -{ - sal_uInt16 nId=aHeaderBar->GetCurItemId(); - - if (!(aHeaderBar->GetItemBits(nId) & HeaderBarItemBits::CLICKABLE)) - return; - - if(nId==nSortCol+1) - { - SortByCol(nId-1,!bSortDirection); - } - else - { - SortByCol(nId-1,bSortDirection); - } -} - -void SvSimpleTable::HBarDrag() -{ - HideTracking(); - if(!aHeaderBar->IsItemMode()) - { - tools::Rectangle aSizeRect(Point(0,0), - SvHeaderTabListBox::GetOutputSizePixel()); - aSizeRect.SetLeft(-GetXOffset()+aHeaderBar->GetDragPos() ); - aSizeRect.SetRight(-GetXOffset()+aHeaderBar->GetDragPos() ); - ShowTracking( aSizeRect, ShowTrackFlags::Split ); - } -} -void SvSimpleTable::HBarEndDrag() -{ - HideTracking(); - sal_uInt16 nPrivTabCount=TabCount(); - - if(nPrivTabCount) - { - if(nPrivTabCount>aHeaderBar->GetItemCount()) - nPrivTabCount=aHeaderBar->GetItemCount(); - - sal_uInt16 nPos=0; - sal_uInt16 nNewSize=0; - for(sal_uInt16 i=1;i<nPrivTabCount;i++) - { - nNewSize = static_cast< sal_uInt16 >( aHeaderBar->GetItemSize(i) ) + nPos; - SetTab( i, nNewSize, MapUnit::MapPixel ); - nPos = nNewSize; - } - } - bPaintFlag = false; - Invalidate(); - Update(); -} - - -IMPL_LINK( SvSimpleTable, StartDragHdl, HeaderBar*, pCtr, void) -{ - if(pCtr==aHeaderBar.get()) - { - if(!aHeaderBar->IsItemMode()) - { - tools::Rectangle aSizeRect(Point(0,0), - SvHeaderTabListBox::GetOutputSizePixel()); - aSizeRect.SetLeft(-GetXOffset()+aHeaderBar->GetDragPos() ); - aSizeRect.SetRight(-GetXOffset()+aHeaderBar->GetDragPos() ); - ShowTracking( aSizeRect, ShowTrackFlags::Split ); - } - } -} - -IMPL_LINK( SvSimpleTable, DragHdl, HeaderBar*, pCtr, void) -{ - if(pCtr==aHeaderBar.get()) - { - HBarDrag(); - } -} - -IMPL_LINK( SvSimpleTable, EndDragHdl, HeaderBar*, pCtr, void) -{ - if(pCtr==aHeaderBar.get()) - { - HBarEndDrag(); - } -} - -IMPL_LINK( SvSimpleTable, HeaderBarClick, HeaderBar*, pCtr, void) -{ - if(pCtr==aHeaderBar.get()) - { - HBarClick(); - } -} - -SvLBoxItem* SvSimpleTable::GetEntryAtPos( SvTreeListEntry* pEntry, sal_uInt16 nPos ) const -{ - DBG_ASSERT(pEntry,"GetEntryText:Invalid Entry"); - SvLBoxItem* pItem = nullptr; - - if( pEntry ) - { - sal_uInt16 nCount = pEntry->ItemCount(); - - nPos++; - - if( nTreeFlags & SvTreeFlags::CHKBTN ) nPos++; - - if( nPos < nCount ) - { - pItem = &pEntry->GetItem( nPos); - } - } - return pItem; -} - -sal_Int32 SvSimpleTable::ColCompare(SvTreeListEntry* pLeft,SvTreeListEntry* pRight) -{ - sal_Int32 nCompare = 0; - - SvLBoxItem* pLeftItem = GetEntryAtPos( pLeft, nSortCol); - SvLBoxItem* pRightItem = GetEntryAtPos( pRight, nSortCol); - - - if(pLeftItem != nullptr && pRightItem != nullptr) - { - SvLBoxItemType nLeftKind = pLeftItem->GetType(); - SvLBoxItemType nRightKind = pRightItem->GetType(); - - if (nRightKind == SvLBoxItemType::String && - nLeftKind == SvLBoxItemType::String) - nCompare = aCollator.compareString( static_cast<SvLBoxString*>(pLeftItem)->GetText(), - static_cast<SvLBoxString*>(pRightItem)->GetText()); - } - return nCompare; -} - -IMPL_LINK( SvSimpleTable, CompareHdl, const SvSortData&, rData, sal_Int32) -{ - SvTreeListEntry* pLeft = const_cast<SvTreeListEntry*>(rData.pLeft); - SvTreeListEntry* pRight = const_cast<SvTreeListEntry*>(rData.pRight); - return ColCompare(pLeft,pRight); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/uitest/uiobject.cxx b/svtools/source/uitest/uiobject.cxx deleted file mode 100644 index a636f1c36d8a..000000000000 --- a/svtools/source/uitest/uiobject.cxx +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#include <memory> -#include <uitest/uiobject.hxx> - -#include <vcl/treelistbox.hxx> -#include <svtools/simptabl.hxx> - -namespace { - -} - -SimpleTableUIObject::SimpleTableUIObject(const VclPtr<SvSimpleTable>& xTable): - TreeListUIObject(xTable), - mxTable(xTable) -{ -} - -StringMap SimpleTableUIObject::get_state() -{ - StringMap aMap = TreeListUIObject::get_state(); - - aMap["ColumnCount"] = OUString::number(mxTable->GetColumnCount()); - aMap["RowCount"] = OUString::number(mxTable->GetRowCount()); - aMap["SelectedRowCount"] = OUString::number(mxTable->GetSelectedRowCount()); - aMap["SelectedColumnCount"] = OUString::number(mxTable->GetSelectedColumnCount()); - aMap["EntryCount"] = OUString::number(mxTable->GetEntryCount()); - - return aMap; -} - -OUString SimpleTableUIObject::get_type() const -{ - return "SimpleTable"; -} - -std::unique_ptr<UIObject> SimpleTableUIObject::createFromContainer(vcl::Window* pWindow) -{ - SvSimpleTableContainer* pTableContainer = dynamic_cast<SvSimpleTableContainer*>(pWindow); - assert(pTableContainer); - return std::unique_ptr<UIObject>(new SimpleTableUIObject(pTableContainer->GetTable())); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |