summaryrefslogtreecommitdiff
path: root/svtools/source
diff options
context:
space:
mode:
Diffstat (limited to 'svtools/source')
-rw-r--r--svtools/source/brwbox/brwbox1.cxx188
-rw-r--r--svtools/source/brwbox/brwbox2.cxx7
-rw-r--r--svtools/source/config/helpopt.cxx18
-rw-r--r--svtools/source/config/optionsdrawinglayer.cxx9
-rw-r--r--svtools/source/contnr/fileview.cxx14
-rw-r--r--svtools/source/contnr/imivctl.hxx827
-rw-r--r--svtools/source/contnr/imivctl1.cxx360
-rw-r--r--svtools/source/contnr/imivctl2.cxx85
-rw-r--r--svtools/source/contnr/ivctrl.cxx6
-rw-r--r--svtools/source/contnr/svicnvw.cxx813
-rw-r--r--svtools/source/contnr/svimpbox.cxx39
-rw-r--r--svtools/source/contnr/svimpicn.cxx4093
-rw-r--r--svtools/source/contnr/svtreebx.cxx27
-rw-r--r--svtools/source/control/ctrlbox.cxx4
-rw-r--r--svtools/source/control/tabbar.cxx167
-rw-r--r--svtools/source/control/taskbar.cxx64
-rw-r--r--svtools/source/control/taskmisc.cxx53
-rw-r--r--svtools/source/control/taskstat.cxx101
-rw-r--r--svtools/source/dialogs/mcvmath.cxx159
-rw-r--r--svtools/source/dialogs/mcvmath.hxx9
-rw-r--r--svtools/source/dialogs/prnsetup.cxx5
-rw-r--r--svtools/source/edit/syntaxhighlight.cxx39
-rw-r--r--svtools/source/edit/textdoc.cxx33
-rw-r--r--svtools/source/edit/textdoc.hxx4
-rw-r--r--svtools/source/edit/texteng.cxx58
-rw-r--r--svtools/source/edit/textundo.cxx41
-rw-r--r--svtools/source/edit/textview.cxx36
-rw-r--r--svtools/source/edit/txtattr.cxx21
-rw-r--r--svtools/source/filter/exportdialog.cxx2
-rw-r--r--svtools/source/filter/filter2.cxx2
-rw-r--r--svtools/source/filter/sgfbram.cxx12
-rw-r--r--svtools/source/filter/sgvtext.cxx42
-rw-r--r--svtools/source/filter/wmf/emfwr.cxx5
-rw-r--r--svtools/source/filter/wmf/enhwmf.cxx35
-rw-r--r--svtools/source/filter/wmf/winmtf.hxx467
-rw-r--r--svtools/source/filter/wmf/wmf.cxx7
-rw-r--r--svtools/source/graphic/grfcache.cxx89
-rw-r--r--svtools/source/graphic/grfmgr.cxx7
-rw-r--r--svtools/source/graphic/grfmgr2.cxx16
-rw-r--r--svtools/source/hatchwindow/hatchwindowfactory.component2
-rw-r--r--svtools/source/hatchwindow/hatchwindowfactory.cxx8
-rw-r--r--svtools/source/inc/svimpbox.hxx1
-rw-r--r--svtools/source/misc/imap.cxx117
-rw-r--r--svtools/source/misc/imap2.cxx313
-rw-r--r--svtools/source/misc/transfer.cxx54
-rw-r--r--svtools/source/misc/transfer2.cxx9
-rw-r--r--svtools/source/misc/unitconv.cxx58
-rw-r--r--svtools/source/productregistration/productregistration.cxx8
-rw-r--r--svtools/source/productregistration/productregistration.uno.component2
-rw-r--r--svtools/source/svhtml/htmlout.cxx44
-rw-r--r--svtools/source/svhtml/parhtml.cxx7
-rw-r--r--svtools/source/svrtf/parrtf.cxx22
-rw-r--r--svtools/source/svrtf/rtfout.cxx21
-rw-r--r--svtools/source/uno/miscservices.cxx8
-rw-r--r--svtools/source/uno/unoiface.cxx1
55 files changed, 1305 insertions, 7334 deletions
diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx
index 31e4a187574f..3619355ce355 100644
--- a/svtools/source/brwbox/brwbox1.cxx
+++ b/svtools/source/brwbox/brwbox1.cxx
@@ -266,36 +266,6 @@ void BrowseBox::InsertHandleColumn( sal_uLong nWidth )
}
//-------------------------------------------------------------------
-void BrowseBox::InsertDataColumn( sal_uInt16 nItemId, const Image& rImage,
- long nWidth, HeaderBarItemBits nBits, sal_uInt16 nPos )
-{
- DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
-
- if ( nPos < pCols->size() )
- {
- BrowserColumns::iterator it = pCols->begin();
- ::std::advance( it, nPos );
- pCols->insert( it, new BrowserColumn( nItemId, rImage, String(), nWidth, GetZoom(), nBits ) );
- }
- else
- {
- pCols->push_back( new BrowserColumn( nItemId, rImage, String(), nWidth, GetZoom(), nBits ) );
- }
- if ( nCurColId == 0 )
- nCurColId = nItemId;
- if ( getDataWindow()->pHeaderBar )
- {
- // Handlecolumn nicht in der Headerbar
- sal_uInt16 nHeaderPos = nPos;
- if (nHeaderPos != HEADERBAR_APPEND && !GetColumnId(0))
- nHeaderPos--;
- getDataWindow()->pHeaderBar->InsertItem(
- nItemId, rImage, nWidth, nBits, nHeaderPos );
- }
- ColumnInserted( nPos );
-}
-
-//-------------------------------------------------------------------
void BrowseBox::InsertDataColumn( sal_uInt16 nItemId, const XubString& rText,
long nWidth, HeaderBarItemBits nBits, sal_uInt16 nPos )
@@ -328,45 +298,6 @@ void BrowseBox::InsertDataColumn( sal_uInt16 nItemId, const XubString& rText,
}
//-------------------------------------------------------------------
-
-void BrowseBox::InsertDataColumn( sal_uInt16 nItemId,
- const Image& rImage, const XubString& rText,
- long nWidth, HeaderBarItemBits nBits, sal_uInt16 nPos,
- const String* pHelpText )
-{
- DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
-
- if ( nPos < pCols->size() )
- {
- BrowserColumns::iterator it = pCols->begin();
- ::std::advance( it, nPos );
- pCols->insert( it, new BrowserColumn( nItemId, rImage, rText, nWidth, GetZoom(), nBits ) );
- }
- else
- {
- pCols->push_back( new BrowserColumn( nItemId, rImage, rText, nWidth, GetZoom(), nBits ) );
- }
-
- if ( nCurColId == 0 )
- nCurColId = nItemId;
- if ( getDataWindow()->pHeaderBar )
- {
- // Handlecolumn nicht in der Headerbar
- sal_uInt16 nHeaderPos = nPos;
- if (nHeaderPos != HEADERBAR_APPEND && !GetColumnId(0))
- nHeaderPos--;
-
- getDataWindow()->pHeaderBar->InsertItem(
- nItemId, rImage, rText, nWidth, nBits, nHeaderPos );
- if( pHelpText && !rText.Len() )
- {
- getDataWindow()->pHeaderBar->SetHelpText(
- nItemId, *pHelpText );
- }
- }
- ColumnInserted( nPos );
-}
-//-------------------------------------------------------------------
sal_uInt16 BrowseBox::ToggleSelectedColumn()
{
sal_uInt16 nSelectedColId = USHRT_MAX;
@@ -594,35 +525,6 @@ void BrowseBox::SetColumnPos( sal_uInt16 nColumnId, sal_uInt16 nPos )
//-------------------------------------------------------------------
-void BrowseBox::SetColumnMode( sal_uInt16 nColumnId, BrowserColumnMode nFlags )
-{
- DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
-
- // never set mode of the handle-column
- if ( nColumnId == 0 )
- return;
-
- // get the position in the current array
- size_t nColumnPos = GetColumnPos( nColumnId );
- if ( nColumnPos >= pCols->size() )
- // not available!
- return;
-
- // does the state change?
- BrowserColumn *pCol = (*pCols)[ nColumnPos ];
- if ( pCol->Flags() != nFlags )
- {
- pCol->Flags() = sal::static_int_cast< HeaderBarItemBits >(nFlags);
-
- // redraw visible colums
- if ( GetUpdateMode() && ( pCol->IsFrozen() || nColumnPos > nFirstCol ) )
- Invalidate( Rectangle( Point(0,0),
- Size( GetOutputSizePixel().Width(), GetTitleHeight() ) ) );
- }
-}
-
-//-------------------------------------------------------------------
-
void BrowseBox::SetColumnTitle( sal_uInt16 nItemId, const String& rTitle )
{
DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
@@ -1213,15 +1115,6 @@ long BrowseBox::ScrollRows( long nRows )
//-------------------------------------------------------------------
-long BrowseBox::ScrollPages( long )
-{
- DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
-
- return ScrollRows( pDataWin->GetSizePixel().Height() / GetDataRowHeight() );
-}
-
-//-------------------------------------------------------------------
-
void BrowseBox::RowModified( long nRow, sal_uInt16 nColId )
{
DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
@@ -1589,12 +1482,6 @@ sal_Bool BrowseBox::GoToRow( long nRow)
//-------------------------------------------------------------------
-sal_Bool BrowseBox::GoToRowAndDoNotModifySelection( long nRow )
-{
- return GoToRow( nRow, sal_False, sal_True );
-}
-
-//-------------------------------------------------------------------
sal_Bool BrowseBox::GoToRow( long nRow, sal_Bool bRowColMove, sal_Bool bKeepSelection )
{
DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
@@ -1808,43 +1695,6 @@ void BrowseBox::SetNoSelection()
//-------------------------------------------------------------------
-void BrowseBox::SetSelection( const MultiSelection &rSel )
-{
- DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
- DBG_ASSERT( bMultiSelection, "SetSelection only allowed with Multi-Selection-Mode" );
-
- // prepare inverted areas
- OSL_TRACE( "BrowseBox: %p->HideCursor", this );
- ToggleSelection();
-
- // assign Selection
- *uRow.pSel = rSel;
-
- // only highlight painted areas
- pDataWin->Update();
-
- // notify derived class
- if ( !bSelecting )
- Select();
- else
- bSelect = sal_True;
-
- // restore screen
- ToggleSelection();
- OSL_TRACE( "BrowseBox: %p->ShowCursor", this );
-
- if ( isAccessibleAlive() )
- {
- commitTableEvent(
- SELECTION_CHANGED,
- Any(),
- Any()
- );
- }
-}
-
-//-------------------------------------------------------------------
-
void BrowseBox::SelectAll()
{
DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
@@ -2078,12 +1928,6 @@ long BrowseBox::FirstSelectedColumn( ) const
}
//-------------------------------------------------------------------
-long BrowseBox::NextSelectedColumn( ) const
-{
- return pColSel ? pColSel->NextSelected() : BROWSER_ENDOFSELECTION;
-}
-
-//-------------------------------------------------------------------
long BrowseBox::FirstSelectedRow( sal_Bool bInverse )
{
@@ -2103,15 +1947,6 @@ long BrowseBox::NextSelectedRow()
//-------------------------------------------------------------------
-long BrowseBox::PrevSelectedRow()
-{
- DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
-
- return bMultiSelection ? uRow.pSel->PrevSelected() : BROWSER_ENDOFSELECTION;
-}
-
-//-------------------------------------------------------------------
-
long BrowseBox::LastSelectedRow()
{
DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
@@ -2140,15 +1975,6 @@ bool BrowseBox::IsColumnSelected( sal_uInt16 nColumnId ) const
//-------------------------------------------------------------------
-sal_Bool BrowseBox::IsAllSelected() const
-{
- DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
-
- return bMultiSelection && uRow.pSel->IsAllSelected();
-}
-
-//-------------------------------------------------------------------
-
sal_Bool BrowseBox::MakeFieldVisible
(
long nRow, // Zeilen-Nr des Feldes (beginnend mit 0)
@@ -2592,13 +2418,6 @@ long BrowseBox::GetDataRowHeight() const
//-------------------------------------------------------------------
-Window& BrowseBox::GetEventWindow() const
-{
- return *getDataWindow()->pEventWin;
-}
-
-//-------------------------------------------------------------------
-
BrowserHeader* BrowseBox::CreateHeaderBar( BrowseBox* pParent )
{
BrowserHeader* pNewBar = new BrowserHeader( pParent );
@@ -2663,13 +2482,6 @@ long BrowseBox::CalcReverseZoom(long nVal)
return nVal;
}
-//-------------------------------------------------------------------
-HeaderBar* BrowseBox::GetHeaderBar() const
-{
- return getDataWindow()->pHeaderBar;
-}
-//-------------------------------------------------------------------
-
void BrowseBox::CursorMoved()
{
// before implementing more here, please adjust the EditBrowseBox
diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx
index 9c9796baa90b..f62a95170c6a 100644
--- a/svtools/source/brwbox/brwbox2.cxx
+++ b/svtools/source/brwbox/brwbox2.cxx
@@ -149,13 +149,6 @@ void BrowseBox::Command( const CommandEvent& rEvt )
//===================================================================
-bool BrowseBox::IsInCommandEvent() const
-{
- return getDataWindow()->bInCommand;
-}
-
-//===================================================================
-
void BrowseBox::StateChanged( StateChangedType nStateChange )
{
Control::StateChanged( nStateChange );
diff --git a/svtools/source/config/helpopt.cxx b/svtools/source/config/helpopt.cxx
index 6e80db6fcf6c..f8cbbcc2b838 100644
--- a/svtools/source/config/helpopt.cxx
+++ b/svtools/source/config/helpopt.cxx
@@ -62,7 +62,6 @@ static sal_Int32 nRefCount = 0;
class SvtHelpOptions_Impl : public utl::ConfigItem
{
- IdList* pList;
sal_Int32 nHelpAgentTimeoutPeriod;
sal_Int32 nHelpAgentRetryLimit;
sal_Bool bExtendedHelp;
@@ -105,9 +104,6 @@ public:
void SetWelcomeScreen( sal_Bool b ) { bWelcomeScreen = b; SetModified(); }
sal_Bool IsWelcomeScreen() const { return bWelcomeScreen; }
- IdList* GetPIStarterList() { return pList; }
- void AddToPIStarterList( sal_Int32 nId );
- void RemoveFromPIStarterList( sal_Int32 nId );
String GetLocale() const { return aLocale; }
String GetSystem() const { return aSystem; }
@@ -168,7 +164,6 @@ Sequence< OUString > SvtHelpOptions_Impl::GetPropertyNames()
SvtHelpOptions_Impl::SvtHelpOptions_Impl()
: ConfigItem( OUString( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Help" )) )
- , pList( 0 )
, bExtendedHelp( sal_False )
, bHelpTips( sal_True )
, bHelpAgentEnabled( sal_False )
@@ -733,19 +728,6 @@ sal_Bool SvtHelpOptions::IsWelcomeScreen() const
return pImp->IsWelcomeScreen();
}
-IdList* SvtHelpOptions::GetPIStarterList()
-{
- return pImp->GetPIStarterList();
-}
-
-void SvtHelpOptions::AddToPIStarterList( sal_Int32 )
-{
-}
-
-void SvtHelpOptions::RemoveFromPIStarterList( sal_Int32 )
-{
-}
-
String SvtHelpOptions::GetLocale() const
{
return pImp->GetLocale();
diff --git a/svtools/source/config/optionsdrawinglayer.cxx b/svtools/source/config/optionsdrawinglayer.cxx
index 410c430810b2..957792d85166 100644
--- a/svtools/source/config/optionsdrawinglayer.cxx
+++ b/svtools/source/config/optionsdrawinglayer.cxx
@@ -388,13 +388,12 @@ SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl() :
DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nI miss some values of configuration keys!\n" );
- // Copy values from list in right order to ouer internal member.
+ // Copy values from list in right order to our internal member.
sal_Int32 nPropertyCount = seqValues.getLength();
- sal_Int32 nProperty = 0;
-
- for( nProperty=0; nProperty<nPropertyCount; ++nProperty )
+ for(sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty )
{
- DBG_ASSERT( !(seqValues[nProperty].hasValue()==sal_False), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nInvalid property value for property detected!\n" );
+ if (seqValues[nProperty].hasValue()==sal_False)
+ continue;
switch( nProperty )
{
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index 6a511bdb4e4b..e8f6f9cc5b60 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -496,15 +496,12 @@ class NameTranslator_Impl : public ::svt::IContentTitleTranslation
private:
NameTranslationList* mpActFolder;
public:
- NameTranslator_Impl( void );
NameTranslator_Impl( const INetURLObject& rActualFolder );
virtual ~NameTranslator_Impl();
// IContentTitleTranslation
virtual sal_Bool GetTranslation( const OUString& rOriginalName, OUString& rTranslatedName ) const;
- void UpdateTranslationTable(); // reads the translation file again
-
void SetActualFolder( const INetURLObject& rActualFolder );
const String* GetTransTableFileName() const;
// returns the name for the file, which contains the translation strings
@@ -1810,11 +1807,6 @@ void SvtFileView::StateChanged( StateChangedType nStateChange )
// class NameTranslator_Impl
// -----------------------------------------------------------------------
-NameTranslator_Impl::NameTranslator_Impl( void ) :
- mpActFolder( NULL )
-{
-}
-
NameTranslator_Impl::NameTranslator_Impl( const INetURLObject& rActualFolder )
{
mpActFolder = new NameTranslationList( rActualFolder );
@@ -1826,12 +1818,6 @@ NameTranslator_Impl::~NameTranslator_Impl()
delete mpActFolder;
}
-void NameTranslator_Impl::UpdateTranslationTable()
-{
- if( mpActFolder )
- mpActFolder->Update();
-}
-
void NameTranslator_Impl::SetActualFolder( const INetURLObject& rActualFolder )
{
HashedEntry aActFolder( rActualFolder );
diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx
index 517f0f6b66f1..18b34b780fde 100644
--- a/svtools/source/contnr/imivctl.hxx
+++ b/svtools/source/contnr/imivctl.hxx
@@ -83,8 +83,8 @@ class IcnGridMap_Impl;
// Breitenoffset Highlight-Rect bei Text
#define LROFFS_TEXT 2
-#define DEFAULT_MAX_VIRT_WIDTH 200
-#define DEFAULT_MAX_VIRT_HEIGHT 200
+#define DEFAULT_MAX_VIRT_WIDTH 200
+#define DEFAULT_MAX_VIRT_HEIGHT 200
#define VIEWMODE_MASK (WB_ICON | WB_SMALLICON | WB_DETAILS)
@@ -105,7 +105,7 @@ enum IcnViewFieldType
//
struct LocalFocus
{
- sal_Bool bOn;
+ sal_Bool bOn;
Rectangle aRect;
Color aPenColor;
@@ -116,32 +116,47 @@ struct LocalFocus
//
// Entry-List
//
-class EntryList_Impl : public List
+typedef ::std::vector< SvxIconChoiceCtrlEntry* > SvxIconChoiceCtrlEntryList_impl;
+
+class EntryList_Impl
{
private:
-
- using List::Replace;
-
+ SvxIconChoiceCtrlEntryList_impl maIconChoiceCtrlEntryList;
SvxIconChoiceCtrl_Impl* _pOwner;
void Removed_Impl( SvxIconChoiceCtrlEntry* pEntry );
public:
- EntryList_Impl(
- SvxIconChoiceCtrl_Impl*,
- sal_uInt16 _nInitSize = 1024,
- sal_uInt16 _nReSize = 1024 );
- EntryList_Impl(
- SvxIconChoiceCtrl_Impl*,
- sal_uInt16 _nBlockSize,
- sal_uInt16 _nInitSize,
- sal_uInt16 _nReSize );
+ EntryList_Impl( SvxIconChoiceCtrl_Impl* );
~EntryList_Impl();
- void Clear();
- void Insert( SvxIconChoiceCtrlEntry* pEntry, sal_uLong nPos );
- SvxIconChoiceCtrlEntry* Remove( sal_uLong nPos );
- void Remove( SvxIconChoiceCtrlEntry* pEntry );
+ void clear();
+
+ SvxIconChoiceCtrlEntry* remove( size_t nPos );
+ void remove( SvxIconChoiceCtrlEntry* pEntry );
+
+ size_t size()
+ {
+ return maIconChoiceCtrlEntryList.size();
+ }
+ size_t size() const
+ {
+ return maIconChoiceCtrlEntryList.size();
+ }
+
+ SvxIconChoiceCtrlEntry* operator[]( size_t nPos )
+ {
+ return ( nPos < maIconChoiceCtrlEntryList.size() )
+ ? maIconChoiceCtrlEntryList[ nPos ]
+ : NULL;
+ }
+ SvxIconChoiceCtrlEntry* operator[]( size_t nPos ) const
+ {
+ return ( nPos < maIconChoiceCtrlEntryList.size() )
+ ? maIconChoiceCtrlEntryList[ nPos ]
+ : NULL;
+ }
+ void insert( size_t nPos, SvxIconChoiceCtrlEntry* pEntry );
};
@@ -155,388 +170,448 @@ class SvxIconChoiceCtrl_Impl
friend class EntryList_Impl;
friend class IcnGridMap_Impl;
- sal_Bool bChooseWithCursor;
- EntryList_Impl aEntries;
- ScrollBar aVerSBar;
- ScrollBar aHorSBar;
- ScrollBarBox aScrBarBox;
- Rectangle aCurSelectionRect;
- SvPtrarr aSelectedRectList;
- Timer aEditTimer; // fuer Inplace-Editieren
- Timer aAutoArrangeTimer;
- Timer aDocRectChangedTimer;
- Timer aVisRectChangedTimer;
- Timer aCallSelectHdlTimer;
- Size aVirtOutputSize;
- Size aImageSize;
- Size aDefaultTextSize;
- Size aOutputSize; // Pixel
- Point aDDLastEntryPos;
- Point aDDLastRectPos;
- Point aDDPaintOffs;
- Point aDDStartPos;
+ sal_Bool bChooseWithCursor;
+ EntryList_Impl aEntries;
+ ScrollBar aVerSBar;
+ ScrollBar aHorSBar;
+ ScrollBarBox aScrBarBox;
+ Rectangle aCurSelectionRect;
+ SvPtrarr aSelectedRectList;
+ Timer aEditTimer; // fuer Inplace-Editieren
+ Timer aAutoArrangeTimer;
+ Timer aDocRectChangedTimer;
+ Timer aVisRectChangedTimer;
+ Timer aCallSelectHdlTimer;
+ Size aVirtOutputSize;
+ Size aImageSize;
+ Size aDefaultTextSize;
+ Size aOutputSize; // Pixel
+ Point aDDLastEntryPos;
+ Point aDDLastRectPos;
+ Point aDDPaintOffs;
+ Point aDDStartPos;
SvtIconChoiceCtrl* pView;
- IcnCursor_Impl* pImpCursor;
- IcnGridMap_Impl* pGridMap;
- long nMaxVirtWidth; // max. Breite aVirtOutputSize bei ALIGN_TOP
- long nMaxVirtHeight; // max. Hoehe aVirtOutputSize bei ALIGN_LEFT
- List* pZOrderList;
- SvPtrarr* pColumns;
- IcnViewEdit_Impl* pEdit;
- WinBits nWinBits;
- long nMaxBoundHeight; // Hoehe des hoechsten BoundRects
- sal_uInt16 nFlags;
- sal_uInt16 nCurTextDrawFlags;
- sal_uLong nUserEventAdjustScrBars;
- sal_uLong nUserEventShowCursor;
+ IcnCursor_Impl* pImpCursor;
+ IcnGridMap_Impl* pGridMap;
+ long nMaxVirtWidth; // max. Breite aVirtOutputSize bei ALIGN_TOP
+ long nMaxVirtHeight; // max. Hoehe aVirtOutputSize bei ALIGN_LEFT
+ SvxIconChoiceCtrlEntryList_impl* pZOrderList;
+ SvPtrarr* pColumns;
+ IcnViewEdit_Impl* pEdit;
+ WinBits nWinBits;
+ long nMaxBoundHeight; // Hoehe des hoechsten BoundRects
+ sal_uInt16 nFlags;
+ sal_uInt16 nCurTextDrawFlags;
+ sal_uLong nUserEventAdjustScrBars;
+ sal_uLong nUserEventShowCursor;
SvxIconChoiceCtrlEntry* pCurHighlightFrame;
- sal_Bool bHighlightFramePressed;
+ sal_Bool bHighlightFramePressed;
SvxIconChoiceCtrlEntry* pHead; // Eintrag oben links
SvxIconChoiceCtrlEntry* pCursor;
SvxIconChoiceCtrlEntry* pPrevDropTarget;
SvxIconChoiceCtrlEntry* pHdlEntry;
SvxIconChoiceCtrlEntry* pDDRefEntry;
- VirtualDevice* pDDDev;
- VirtualDevice* pDDBufDev;
- VirtualDevice* pDDTempDev;
- VirtualDevice* pEntryPaintDev;
+ VirtualDevice* pDDDev;
+ VirtualDevice* pDDBufDev;
+ VirtualDevice* pDDTempDev;
+ VirtualDevice* pEntryPaintDev;
SvxIconChoiceCtrlEntry* pAnchor; // fuer Selektion
- LocalFocus aFocus; // Data for focusrect
+ LocalFocus aFocus; // Data for focusrect
::svt::AccessibleFactoryAccess aAccFactory;
- List* pDraggedSelection;
+ List* pDraggedSelection;
SvxIconChoiceCtrlEntry* pCurEditedEntry;
SvxIconChoiceCtrlTextMode eTextMode;
- SelectionMode eSelectionMode;
- sal_uLong nSelectionCount;
+ SelectionMode eSelectionMode;
+ sal_uLong nSelectionCount;
SvxIconChoiceCtrlPositionMode ePositionMode;
- sal_Bool bBoundRectsDirty;
- sal_Bool bUpdateMode;
- sal_Bool bEntryEditingEnabled;
- sal_Bool bInDragDrop;
-
- void ShowCursor( sal_Bool bShow );
-
- void ImpArrange( sal_Bool bKeepPredecessors = sal_False );
- void AdjustVirtSize( const Rectangle& );
- void ResetVirtSize();
- void CheckScrollBars();
-
- DECL_LINK( ScrollUpDownHdl, ScrollBar * );
- DECL_LINK( ScrollLeftRightHdl, ScrollBar * );
- DECL_LINK( EditTimeoutHdl, Timer* );
- DECL_LINK( UserEventHdl, void* );
- DECL_LINK( EndScrollHdl, void* );
- DECL_LINK( AutoArrangeHdl, void* );
- DECL_LINK( DocRectChangedHdl, void* );
- DECL_LINK( VisRectChangedHdl, void* );
- DECL_LINK( CallSelectHdlHdl, void* );
-
- void AdjustScrollBars( sal_Bool bVirtSizeGrowedOnly = sal_False);
- void PositionScrollBars( long nRealWidth, long nRealHeight );
- long GetScrollBarPageSize( long nVisibleRange ) const { return ((nVisibleRange*75)/100); }
- long GetScrollBarLineSize() const { return nMaxBoundHeight / 2; }
+ sal_Bool bBoundRectsDirty;
+ sal_Bool bUpdateMode;
+ sal_Bool bEntryEditingEnabled;
+ sal_Bool bInDragDrop;
+
+ void ShowCursor( sal_Bool bShow );
+
+ void ImpArrange( sal_Bool bKeepPredecessors = sal_False );
+ void AdjustVirtSize( const Rectangle& );
+ void ResetVirtSize();
+ void CheckScrollBars();
+
+ DECL_LINK( ScrollUpDownHdl, ScrollBar * );
+ DECL_LINK( ScrollLeftRightHdl, ScrollBar * );
+ DECL_LINK( EditTimeoutHdl, Timer* );
+ DECL_LINK( UserEventHdl, void* );
+ DECL_LINK( EndScrollHdl, void* );
+ DECL_LINK( AutoArrangeHdl, void* );
+ DECL_LINK( DocRectChangedHdl, void* );
+ DECL_LINK( VisRectChangedHdl, void* );
+ DECL_LINK( CallSelectHdlHdl, void* );
+
+ void AdjustScrollBars( sal_Bool bVirtSizeGrowedOnly = sal_False);
+ void PositionScrollBars( long nRealWidth, long nRealHeight );
+ long GetScrollBarPageSize( long nVisibleRange ) const
+ {
+ return ((nVisibleRange*75)/100);
+ }
+ long GetScrollBarLineSize() const
+ {
+ return nMaxBoundHeight / 2;
+ }
sal_Bool HandleScrollCommand( const CommandEvent& rCmd );
- void ToDocPos( Point& rPosPixel ) { rPosPixel -= pView->GetMapMode().GetOrigin(); }
- void InitScrollBarBox();
+ void ToDocPos( Point& rPosPixel )
+ {
+ rPosPixel -= pView->GetMapMode().GetOrigin();
+ }
+ void InitScrollBarBox();
SvxIconChoiceCtrlEntry* FindNewCursor();
- void ToggleSelection( SvxIconChoiceCtrlEntry* );
- void DeselectAllBut( SvxIconChoiceCtrlEntry*, sal_Bool bPaintSync=sal_False );
- void Center( SvxIconChoiceCtrlEntry* pEntry ) const;
- void StopEditTimer() { aEditTimer.Stop(); }
- void StartEditTimer() { aEditTimer.Start(); }
- void ImpHideDDIcon();
- void CallSelectHandler( SvxIconChoiceCtrlEntry* );
- void SelectRect(
- SvxIconChoiceCtrlEntry* pEntry1,
- SvxIconChoiceCtrlEntry* pEntry2,
- sal_Bool bAdd = sal_True,
- SvPtrarr* pOtherRects = 0 );
-
- void SelectRange(
- SvxIconChoiceCtrlEntry* pStart,
- SvxIconChoiceCtrlEntry* pEnd,
- sal_Bool bAdd = sal_True );
-
- void AddSelectedRect( const Rectangle& );
- void AddSelectedRect(
- SvxIconChoiceCtrlEntry* pEntry1,
- SvxIconChoiceCtrlEntry* pEntry2 );
-
- void ClearSelectedRectList();
- void ClearColumnList();
- Rectangle CalcMaxTextRect( const SvxIconChoiceCtrlEntry* pEntry ) const;
-
- void ClipAtVirtOutRect( Rectangle& rRect ) const;
- void AdjustAtGrid( const SvPtrarr& rRow, SvxIconChoiceCtrlEntry* pStart=0 );
- Point AdjustAtGrid(
- const Rectangle& rCenterRect, // "Schwerpunkt" des Objekts (typ. Bmp-Rect)
- const Rectangle& rBoundRect ) const;
+ void ToggleSelection( SvxIconChoiceCtrlEntry* );
+ void DeselectAllBut( SvxIconChoiceCtrlEntry*, sal_Bool bPaintSync=sal_False );
+ void Center( SvxIconChoiceCtrlEntry* pEntry ) const;
+ void StopEditTimer() { aEditTimer.Stop(); }
+ void StartEditTimer() { aEditTimer.Start(); }
+ void ImpHideDDIcon();
+ void CallSelectHandler( SvxIconChoiceCtrlEntry* );
+ void SelectRect(
+ SvxIconChoiceCtrlEntry* pEntry1,
+ SvxIconChoiceCtrlEntry* pEntry2,
+ sal_Bool bAdd = sal_True,
+ SvPtrarr* pOtherRects = 0
+ );
+
+ void SelectRange(
+ SvxIconChoiceCtrlEntry* pStart,
+ SvxIconChoiceCtrlEntry* pEnd,
+ sal_Bool bAdd = sal_True
+ );
+
+ void AddSelectedRect( const Rectangle& );
+ void AddSelectedRect(
+ SvxIconChoiceCtrlEntry* pEntry1,
+ SvxIconChoiceCtrlEntry* pEntry2
+ );
+
+ void ClearSelectedRectList();
+ void ClearColumnList();
+ Rectangle CalcMaxTextRect( const SvxIconChoiceCtrlEntry* pEntry ) const;
+
+ void ClipAtVirtOutRect( Rectangle& rRect ) const;
+ void AdjustAtGrid( const SvPtrarr& rRow, SvxIconChoiceCtrlEntry* pStart=0 );
+ Point AdjustAtGrid(
+ const Rectangle& rCenterRect, // "Schwerpunkt" des Objekts (typ. Bmp-Rect)
+ const Rectangle& rBoundRect
+ ) const;
sal_uLong GetPredecessorGrid( const Point& rDocPos) const;
- void InitPredecessors();
- void ClearPredecessors();
+ void InitPredecessors();
+ void ClearPredecessors();
sal_Bool CheckVerScrollBar();
sal_Bool CheckHorScrollBar();
- void CancelUserEvents();
- void EntrySelected( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bSelect,
- sal_Bool bSyncPaint );
- void SaveSelection( List** );
- void RepaintEntries( sal_uInt16 nEntryFlagsMask );
- void SetListPositions();
- void SetDefaultTextSize();
- sal_Bool IsAutoArrange() const {
- return (sal_Bool)(ePositionMode == IcnViewPositionModeAutoArrange); }
- sal_Bool IsAutoAdjust() const {
- return (sal_Bool)(ePositionMode == IcnViewPositionModeAutoAdjust); }
- void DocRectChanged() { aDocRectChangedTimer.Start(); }
- void VisRectChanged() { aVisRectChangedTimer.Start(); }
- void SetOrigin( const Point&, sal_Bool bDoNotUpdateWallpaper = sal_False );
-
- DECL_LINK( TextEditEndedHdl, IcnViewEdit_Impl* );
-
- void ShowFocus ( Rectangle& rRect );
- void HideFocus ();
- void DrawFocusRect ( OutputDevice* pOut );
+ void CancelUserEvents();
+ void EntrySelected(
+ SvxIconChoiceCtrlEntry* pEntry,
+ sal_Bool bSelect,
+ sal_Bool bSyncPaint
+ );
+ void SaveSelection( List** );
+ void RepaintEntries( sal_uInt16 nEntryFlagsMask );
+ void SetListPositions();
+ void SetDefaultTextSize();
+ sal_Bool IsAutoArrange() const
+ {
+ return (sal_Bool)(ePositionMode == IcnViewPositionModeAutoArrange);
+ }
+ sal_Bool IsAutoAdjust() const
+ {
+ return (sal_Bool)(ePositionMode == IcnViewPositionModeAutoAdjust);
+ }
+ void DocRectChanged() { aDocRectChangedTimer.Start(); }
+ void VisRectChanged() { aVisRectChangedTimer.Start(); }
+ void SetOrigin( const Point&, sal_Bool bDoNotUpdateWallpaper = sal_False );
+
+ DECL_LINK( TextEditEndedHdl, IcnViewEdit_Impl* );
+
+ void ShowFocus ( Rectangle& rRect );
+ void HideFocus ();
+ void DrawFocusRect ( OutputDevice* pOut );
sal_Bool IsMnemonicChar( sal_Unicode cChar, sal_uLong& rPos ) const;
public:
- long nGridDX,
- nGridDY;
- long nHorSBarHeight,
- nVerSBarWidth;
+ long nGridDX;
+ long nGridDY;
+ long nHorSBarHeight;
+ long nVerSBarWidth;
- SvxIconChoiceCtrl_Impl( SvtIconChoiceCtrl* pView, WinBits nWinStyle );
- ~SvxIconChoiceCtrl_Impl();
+ SvxIconChoiceCtrl_Impl( SvtIconChoiceCtrl* pView, WinBits nWinStyle );
+ ~SvxIconChoiceCtrl_Impl();
sal_Bool SetChoiceWithCursor ( sal_Bool bDo = sal_True ) { sal_Bool bOld=bChooseWithCursor; bChooseWithCursor = bDo; return bOld; }
- void Clear( sal_Bool bInCtor = sal_False );
- void SetStyle( WinBits nWinStyle );
- WinBits GetStyle() const { return nWinBits; }
- void InsertEntry( SvxIconChoiceCtrlEntry*, sal_uLong nPos, const Point* pPos=0 );
- void CreateAutoMnemonics( MnemonicGenerator* _pGenerator = NULL );
- void RemoveEntry( SvxIconChoiceCtrlEntry* pEntry );
- void FontModified();
- void SelectAll( sal_Bool bSelect = sal_True, sal_Bool bPaint = sal_True );
- void SelectEntry(
- SvxIconChoiceCtrlEntry*,
- sal_Bool bSelect,
- sal_Bool bCallHdl = sal_True,
- sal_Bool bAddToSelection = sal_False,
- sal_Bool bSyncPaint = sal_False );
- void Paint( const Rectangle& rRect );
+ void Clear( sal_Bool bInCtor = sal_False );
+ void SetStyle( WinBits nWinStyle );
+ WinBits GetStyle() const { return nWinBits; }
+ void InsertEntry( SvxIconChoiceCtrlEntry*, size_t nPos, const Point* pPos=0 );
+ void CreateAutoMnemonics( MnemonicGenerator* _pGenerator = NULL );
+ void RemoveEntry( SvxIconChoiceCtrlEntry* pEntry );
+ void FontModified();
+ void SelectAll( sal_Bool bSelect = sal_True, sal_Bool bPaint = sal_True );
+ void SelectEntry(
+ SvxIconChoiceCtrlEntry*,
+ sal_Bool bSelect,
+ sal_Bool bCallHdl = sal_True,
+ sal_Bool bAddToSelection = sal_False,
+ sal_Bool bSyncPaint = sal_False
+ );
+ void Paint( const Rectangle& rRect );
sal_Bool MouseButtonDown( const MouseEvent& );
sal_Bool MouseButtonUp( const MouseEvent& );
sal_Bool MouseMove( const MouseEvent&);
sal_Bool RequestHelp( const HelpEvent& rHEvt );
- void SetCursor_Impl(
- SvxIconChoiceCtrlEntry* pOldCursor,
- SvxIconChoiceCtrlEntry* pNewCursor,
- sal_Bool bMod1,
- sal_Bool bShift,
- sal_Bool bPaintSync = sal_False);
+ void SetCursor_Impl(
+ SvxIconChoiceCtrlEntry* pOldCursor,
+ SvxIconChoiceCtrlEntry* pNewCursor,
+ sal_Bool bMod1,
+ sal_Bool bShift,
+ sal_Bool bPaintSync = sal_False
+ );
sal_Bool KeyInput( const KeyEvent& );
- void Resize();
- void GetFocus();
- void LoseFocus();
- void SetUpdateMode( sal_Bool bUpdate );
+ void Resize();
+ void GetFocus();
+ void LoseFocus();
+ void SetUpdateMode( sal_Bool bUpdate );
sal_Bool GetUpdateMode() const { return bUpdateMode; }
- void PaintEntry( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bIsBackgroundPainted=sal_False );
- void PaintEntry(
- SvxIconChoiceCtrlEntry*,
- const Point&,
- OutputDevice* pOut = 0,
- sal_Bool bIsBackgroundPainted = sal_False);
- void PaintEntryVirtOutDev( SvxIconChoiceCtrlEntry* );
-
- void SetEntryPos(
- SvxIconChoiceCtrlEntry* pEntry,
- const Point& rPos,
- sal_Bool bAdjustRow = sal_False,
- sal_Bool bCheckScrollBars = sal_False,
- sal_Bool bKeepGridMap = sal_False );
-
- void InvalidateEntry( SvxIconChoiceCtrlEntry* );
+ void PaintEntry(
+ SvxIconChoiceCtrlEntry* pEntry,
+ sal_Bool bIsBackgroundPainted=sal_False
+ );
+ void PaintEntry(
+ SvxIconChoiceCtrlEntry*,
+ const Point&,
+ OutputDevice* pOut = 0,
+ sal_Bool bIsBackgroundPainted = sal_False
+ );
+ void PaintEntryVirtOutDev( SvxIconChoiceCtrlEntry* );
+
+ void SetEntryPos(
+ SvxIconChoiceCtrlEntry* pEntry,
+ const Point& rPos,
+ sal_Bool bAdjustRow = sal_False,
+ sal_Bool bCheckScrollBars = sal_False,
+ sal_Bool bKeepGridMap = sal_False
+ );
+
+ void InvalidateEntry( SvxIconChoiceCtrlEntry* );
IcnViewFieldType GetItem( SvxIconChoiceCtrlEntry*, const Point& rAbsPos );
- void SetNoSelection();
+ void SetNoSelection();
SvxIconChoiceCtrlEntry* GetCurEntry() const { return pCursor; }
- void SetCursor(
- SvxIconChoiceCtrlEntry*,
- // sal_True == bei Single-Selection die Sel. mitfuehren
- sal_Bool bSyncSingleSelection = sal_True,
- sal_Bool bShowFocusAsync = sal_False );
+ void SetCursor(
+ SvxIconChoiceCtrlEntry*,
+ // sal_True == bei Single-Selection die Sel. mitfuehren
+ sal_Bool bSyncSingleSelection = sal_True,
+ sal_Bool bShowFocusAsync = sal_False
+ );
SvxIconChoiceCtrlEntry* GetEntry( const Point& rDocPos, sal_Bool bHit = sal_False );
SvxIconChoiceCtrlEntry* GetNextEntry( const Point& rDocPos, SvxIconChoiceCtrlEntry* pCurEntry );
- SvxIconChoiceCtrlEntry* GetPrevEntry( const Point& rDocPos, SvxIconChoiceCtrlEntry* pCurEntry );
-
- Point GetEntryPos( SvxIconChoiceCtrlEntry* );
- void MakeEntryVisible( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bBound = sal_True );
-
- void Arrange(sal_Bool bKeepPredecessors = sal_False, long nSetMaxVirtWidth =0, long nSetMaxVirtHeight =0 );
-
- Rectangle CalcFocusRect( SvxIconChoiceCtrlEntry* );
- Rectangle CalcBmpRect( SvxIconChoiceCtrlEntry*, const Point* pPos = 0 );
- Rectangle CalcTextRect(
- SvxIconChoiceCtrlEntry*,
- const Point* pPos = 0,
- sal_Bool bForInplaceEdit = sal_False,
- const String* pStr = 0 );
-
- long CalcBoundingWidth( SvxIconChoiceCtrlEntry* ) const;
- long CalcBoundingHeight( SvxIconChoiceCtrlEntry* ) const;
- Size CalcBoundingSize( SvxIconChoiceCtrlEntry* ) const;
- void FindBoundingRect( SvxIconChoiceCtrlEntry* pEntry );
- void SetBoundingRect_Impl(
- SvxIconChoiceCtrlEntry* pEntry,
- const Point& rPos,
- const Size& rBoundingSize );
+
+ Point GetEntryPos( SvxIconChoiceCtrlEntry* );
+ void MakeEntryVisible( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bBound = sal_True );
+
+ void Arrange(
+ sal_Bool bKeepPredecessors = sal_False,
+ long nSetMaxVirtWidth =0,
+ long nSetMaxVirtHeight =0
+ );
+
+ Rectangle CalcFocusRect( SvxIconChoiceCtrlEntry* );
+ Rectangle CalcBmpRect( SvxIconChoiceCtrlEntry*, const Point* pPos = 0 );
+ Rectangle CalcTextRect(
+ SvxIconChoiceCtrlEntry*,
+ const Point* pPos = 0,
+ sal_Bool bForInplaceEdit = sal_False,
+ const String* pStr = 0
+ );
+
+ long CalcBoundingWidth( SvxIconChoiceCtrlEntry* ) const;
+ long CalcBoundingHeight( SvxIconChoiceCtrlEntry* ) const;
+ Size CalcBoundingSize( SvxIconChoiceCtrlEntry* ) const;
+ void FindBoundingRect( SvxIconChoiceCtrlEntry* pEntry );
+ void SetBoundingRect_Impl(
+ SvxIconChoiceCtrlEntry* pEntry,
+ const Point& rPos,
+ const Size& rBoundingSize
+ );
// berechnet alle BoundRects neu
- void RecalcAllBoundingRects();
+ void RecalcAllBoundingRects();
// berechnet alle ungueltigen BoundRects neu
- void RecalcAllBoundingRectsSmart();
- const Rectangle& GetEntryBoundRect( SvxIconChoiceCtrlEntry* );
- void InvalidateBoundingRect( SvxIconChoiceCtrlEntry* );
- void InvalidateBoundingRect( Rectangle& rRect ) { rRect.Right() = LONG_MAX; bBoundRectsDirty = sal_True; }
+ void RecalcAllBoundingRectsSmart();
+ const Rectangle& GetEntryBoundRect( SvxIconChoiceCtrlEntry* );
+ void InvalidateBoundingRect( SvxIconChoiceCtrlEntry* );
+ void InvalidateBoundingRect( Rectangle& rRect ) { rRect.Right() = LONG_MAX; bBoundRectsDirty = sal_True; }
sal_Bool IsBoundingRectValid( const Rectangle& rRect ) const { return (sal_Bool)( rRect.Right() != LONG_MAX ); }
- void PaintEmphasis(
- const Rectangle& rRect1,
- const Rectangle& rRect2,
- sal_Bool bSelected,
- sal_Bool bDropTarget,
- sal_Bool bCursored,
- OutputDevice* pOut,
- sal_Bool bIsBackgroundPainted = sal_False);
-
- void PaintItem(
- const Rectangle& rRect,
- IcnViewFieldType eItem,
- SvxIconChoiceCtrlEntry* pEntry,
- sal_uInt16 nPaintFlags,
- OutputDevice* pOut,
- const String* pStr = 0,
- ::vcl::ControlLayoutData* _pLayoutData = NULL );
+ void PaintEmphasis(
+ const Rectangle& rRect1,
+ const Rectangle& rRect2,
+ sal_Bool bSelected,
+ sal_Bool bDropTarget,
+ sal_Bool bCursored,
+ OutputDevice* pOut,
+ sal_Bool bIsBackgroundPainted = sal_False
+ );
+
+ void PaintItem(
+ const Rectangle& rRect,
+ IcnViewFieldType eItem,
+ SvxIconChoiceCtrlEntry* pEntry,
+ sal_uInt16 nPaintFlags,
+ OutputDevice* pOut,
+ const String* pStr = 0,
+ ::vcl::ControlLayoutData* _pLayoutData = NULL
+ );
// berechnet alle BoundingRects neu, wenn bMustRecalcBoundingRects == sal_True
- void CheckBoundingRects() { if (bBoundRectsDirty) RecalcAllBoundingRectsSmart(); }
+ void CheckBoundingRects() { if (bBoundRectsDirty) RecalcAllBoundingRectsSmart(); }
// berechnet alle invalidierten BoundingRects neu
- void UpdateBoundingRects();
- void ShowTargetEmphasis( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bShow );
- void PrepareCommandEvent( const CommandEvent& );
- void Command( const CommandEvent& rCEvt );
- void ToTop( SvxIconChoiceCtrlEntry* );
+ void UpdateBoundingRects();
+ void ShowTargetEmphasis( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bShow );
+ void PrepareCommandEvent( const CommandEvent& );
+ void Command( const CommandEvent& rCEvt );
+ void ToTop( SvxIconChoiceCtrlEntry* );
sal_uLong GetSelectionCount() const;
- void SetGrid( const Size& );
- Size GetMinGrid() const;
+ void SetGrid( const Size& );
+ Size GetMinGrid() const;
sal_uLong GetGridCount(
const Size& rSize,
sal_Bool bCheckScrBars,
sal_Bool bSmartScrBar ) const;
- void Scroll( long nDeltaX, long nDeltaY, sal_Bool bScrollBar = sal_False );
- const Size& GetItemSize( SvxIconChoiceCtrlEntry*, IcnViewFieldType ) const;
+ void Scroll( long nDeltaX, long nDeltaY, sal_Bool bScrollBar = sal_False );
+ const Size& GetItemSize( SvxIconChoiceCtrlEntry*, IcnViewFieldType ) const;
- void HideDDIcon();
- void ShowDDIcon( SvxIconChoiceCtrlEntry* pRefEntry, const Point& rPos );
- void HideShowDDIcon(
- SvxIconChoiceCtrlEntry* pRefEntry,
- const Point& rPos );
+ void HideDDIcon();
+ void ShowDDIcon( SvxIconChoiceCtrlEntry* pRefEntry, const Point& rPos );
+ void HideShowDDIcon(
+ SvxIconChoiceCtrlEntry* pRefEntry,
+ const Point& rPos
+ );
sal_Bool IsOver(
- SvPtrarr* pSelectedRectList,
- const Rectangle& rEntryBoundRect ) const;
-
- void SelectRect(
- const Rectangle&,
- sal_Bool bAdd = sal_True,
- SvPtrarr* pOtherRects = 0 );
-
- void CalcScrollOffsets(
- const Point& rRefPosPixel,
- long& rX,
- long& rY,
- sal_Bool bDragDrop = sal_False,
- sal_uInt16 nBorderWidth = 10 );
+ SvPtrarr* pSelectedRectList,
+ const Rectangle& rEntryBoundRect
+ ) const;
+
+ void SelectRect(
+ const Rectangle&,
+ sal_Bool bAdd = sal_True,
+ SvPtrarr* pOtherRects = 0
+ );
+
+ void CalcScrollOffsets(
+ const Point& rRefPosPixel,
+ long& rX,
+ long& rY,
+ sal_Bool bDragDrop = sal_False,
+ sal_uInt16 nBorderWidth = 10
+ );
sal_Bool IsTextHit( SvxIconChoiceCtrlEntry* pEntry, const Point& rDocPos );
- void MakeVisible(
- const Rectangle& rDocPos,
- sal_Bool bInScrollBarEvent=sal_False,
- sal_Bool bCallRectChangedHdl = sal_True );
-
- void AdjustEntryAtGrid( SvxIconChoiceCtrlEntry* pStart = 0 );
- void SetEntryTextMode( SvxIconChoiceCtrlTextMode, SvxIconChoiceCtrlEntry* pEntry = 0 );
+ void MakeVisible(
+ const Rectangle& rDocPos,
+ sal_Bool bInScrollBarEvent=sal_False,
+ sal_Bool bCallRectChangedHdl = sal_True
+ );
+
+ void AdjustEntryAtGrid( SvxIconChoiceCtrlEntry* pStart = 0 );
+ void SetEntryTextMode(
+ SvxIconChoiceCtrlTextMode,
+ SvxIconChoiceCtrlEntry* pEntry = 0
+ );
SvxIconChoiceCtrlTextMode GetTextMode( const SvxIconChoiceCtrlEntry* pEntry = 0 ) const;
- void ShowEntryFocusRect( const SvxIconChoiceCtrlEntry* pEntry );
- void EnableEntryEditing( sal_Bool bEnable ) { bEntryEditingEnabled = bEnable; }
+ void ShowEntryFocusRect( const SvxIconChoiceCtrlEntry* pEntry );
+ void EnableEntryEditing( sal_Bool bEnable ) { bEntryEditingEnabled = bEnable; }
sal_Bool IsEntryEditingEnabled() const { return bEntryEditingEnabled; }
sal_Bool IsEntryEditing() const { return (sal_Bool)(pCurEditedEntry!=0); }
- void EditEntry( SvxIconChoiceCtrlEntry* pEntry );
- void StopEntryEditing( sal_Bool bCancel );
- void LockEntryPos( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bLock );
- sal_uLong GetEntryCount() const { return aEntries.Count(); }
- SvxIconChoiceCtrlEntry* GetEntry( sal_uLong nPos ) const { return (SvxIconChoiceCtrlEntry*)aEntries.GetObject(nPos); }
+ void EditEntry( SvxIconChoiceCtrlEntry* pEntry );
+ void StopEntryEditing( sal_Bool bCancel );
+ void LockEntryPos( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bLock );
+ size_t GetEntryCount() const { return aEntries.size(); }
+ SvxIconChoiceCtrlEntry* GetEntry( size_t nPos )
+ {
+ return aEntries[ nPos ];
+ }
+ SvxIconChoiceCtrlEntry* GetEntry( size_t nPos ) const
+ {
+ return aEntries[ nPos ];
+ }
SvxIconChoiceCtrlEntry* GetFirstSelectedEntry( sal_uLong& ) const;
SvxIconChoiceCtrlEntry* GetNextSelectedEntry( sal_uLong& ) const;
SvxIconChoiceCtrlEntry* GetHdlEntry() const { return pHdlEntry; }
- void SetHdlEntry( SvxIconChoiceCtrlEntry* pEntry ) { pHdlEntry = pEntry; }
+ void SetHdlEntry( SvxIconChoiceCtrlEntry* pEntry ) { pHdlEntry = pEntry; }
SvxIconChoiceCtrlTextMode GetEntryTextModeSmart( const SvxIconChoiceCtrlEntry* pEntry ) const;
- void SetSelectionMode( SelectionMode eMode ) { eSelectionMode=eMode; }
- SelectionMode GetSelectionMode() const { return eSelectionMode; }
+ void SetSelectionMode( SelectionMode eMode ) { eSelectionMode=eMode; }
+ SelectionMode GetSelectionMode() const { return eSelectionMode; }
sal_Bool AreEntriesMoved() const { return (sal_Bool)((nFlags & F_MOVED_ENTRIES)!=0); }
- void SetEntriesMoved( sal_Bool bMoved )
- {
- if( bMoved ) nFlags |= F_MOVED_ENTRIES;
- else nFlags &= ~(F_MOVED_ENTRIES);
- }
+ void SetEntriesMoved( sal_Bool bMoved )
+ {
+ if( bMoved )
+ nFlags |= F_MOVED_ENTRIES;
+ else
+ nFlags &= ~(F_MOVED_ENTRIES);
+ }
sal_uLong GetEntryListPos( SvxIconChoiceCtrlEntry* ) const;
- void SetEntryListPos( SvxIconChoiceCtrlEntry* pEntry, sal_uLong nNewPos );
- void SetEntryImageSize( const Size& rSize ) { aImageSize = rSize; }
- void SetEntryFlags( SvxIconChoiceCtrlEntry* pEntry, sal_uInt16 nFlags );
+ void SetEntryListPos( SvxIconChoiceCtrlEntry* pEntry, sal_uLong nNewPos );
+ void SetEntryImageSize( const Size& rSize ) { aImageSize = rSize; }
+ void SetEntryFlags( SvxIconChoiceCtrlEntry* pEntry, sal_uInt16 nFlags );
SvxIconChoiceCtrlEntry* GoLeftRight( SvxIconChoiceCtrlEntry*, sal_Bool bRight );
SvxIconChoiceCtrlEntry* GoUpDown( SvxIconChoiceCtrlEntry*, sal_Bool bDown );
- void InitSettings();
- Rectangle GetOutputRect() const;
+ void InitSettings();
+ Rectangle GetOutputRect() const;
sal_Bool ArePredecessorsSet() const { return (sal_Bool)(pHead != 0); }
SvxIconChoiceCtrlEntry* GetPredecessorHead() const { return pHead; }
- void SetEntryPredecessor(SvxIconChoiceCtrlEntry* pEntry,SvxIconChoiceCtrlEntry* pPredecessor);
+ void SetEntryPredecessor(SvxIconChoiceCtrlEntry* pEntry,SvxIconChoiceCtrlEntry* pPredecessor);
sal_Bool GetEntryPredecessor(SvxIconChoiceCtrlEntry* pEntry,SvxIconChoiceCtrlEntry** ppPredecessor);
// liefert gueltige Ergebnisse nur im AutoArrange-Modus!
SvxIconChoiceCtrlEntry* FindEntryPredecessor( SvxIconChoiceCtrlEntry* pEntry, const Point& );
- void SetPositionMode( SvxIconChoiceCtrlPositionMode );
+ void SetPositionMode( SvxIconChoiceCtrlPositionMode );
SvxIconChoiceCtrlPositionMode GetPositionMode() const { return ePositionMode;}
- void Flush();
- void SetColumn( sal_uInt16 nIndex, const SvxIconChoiceCtrlColumnInfo& );
+ void Flush();
+ void SetColumn( sal_uInt16 nIndex, const SvxIconChoiceCtrlColumnInfo& );
const SvxIconChoiceCtrlColumnInfo* GetColumn( sal_uInt16 nIndex ) const;
const SvxIconChoiceCtrlColumnInfo* GetItemColumn( sal_uInt16 nSubItem, long& rLeft ) const;
- Rectangle GetDocumentRect() const { return Rectangle( Point(), aVirtOutputSize ); }
- Rectangle GetVisibleRect() const { return GetOutputRect(); }
-
- void SetEntryHighlightFrame( SvxIconChoiceCtrlEntry* pEntry,sal_Bool bKeepHighlightFlags=sal_False );
- void HideEntryHighlightFrame();
- void DrawHighlightFrame( OutputDevice* pOut,
- const Rectangle& rBmpRect, sal_Bool bHide );
- void StopSelectTimer() { aCallSelectHdlTimer.Stop(); }
- void Tracking( const TrackingEvent& rTEvt );
- Point GetPopupMenuPosPixel() const;
+ Rectangle GetDocumentRect() const { return Rectangle( Point(), aVirtOutputSize ); }
+ Rectangle GetVisibleRect() const { return GetOutputRect(); }
+
+ void SetEntryHighlightFrame(
+ SvxIconChoiceCtrlEntry* pEntry,
+ sal_Bool bKeepHighlightFlags=sal_False
+ );
+ void HideEntryHighlightFrame();
+ void DrawHighlightFrame(
+ OutputDevice* pOut,
+ const Rectangle& rBmpRect,
+ sal_Bool bHide
+ );
+ void StopSelectTimer() { aCallSelectHdlTimer.Stop(); }
+ void Tracking( const TrackingEvent& rTEvt );
+ Point GetPopupMenuPosPixel() const;
sal_Bool HandleShortCutKey( const KeyEvent& rKeyEvent );
- void CallEventListeners( sal_uLong nEvent, void* pData = NULL );
+ void CallEventListeners( sal_uLong nEvent, void* pData = NULL );
- inline ::svt::IAccessibleFactory&
- GetAccessibleFactory() { return aAccFactory.getFactory(); }
+ inline ::svt::IAccessibleFactory& GetAccessibleFactory()
+ {
+ return aAccFactory.getFactory();
+ }
};
// ----------------------------------------------------------------------------------------------
@@ -544,28 +619,40 @@ public:
class IcnCursor_Impl
{
SvxIconChoiceCtrl_Impl* pView;
- SvPtrarr* pColumns;
- SvPtrarr* pRows;
- long nCols;
- long nRows;
- short nDeltaWidth;
- short nDeltaHeight;
+ SvPtrarr* pColumns;
+ SvPtrarr* pRows;
+ long nCols;
+ long nRows;
+ short nDeltaWidth;
+ short nDeltaHeight;
SvxIconChoiceCtrlEntry* pCurEntry;
- void SetDeltas();
- void ImplCreate();
- void Create() { if( !pColumns ) ImplCreate(); }
-
- sal_uInt16 GetSortListPos( SvPtrarr* pList, long nValue, int bVertical);
- SvxIconChoiceCtrlEntry* SearchCol(sal_uInt16 nCol,sal_uInt16 nTop,sal_uInt16 nBottom,sal_uInt16 nPref,
- sal_Bool bDown, sal_Bool bSimple );
-
- SvxIconChoiceCtrlEntry* SearchRow(sal_uInt16 nRow,sal_uInt16 nRight,sal_uInt16 nLeft,sal_uInt16 nPref,
- sal_Bool bRight, sal_Bool bSimple );
+ void SetDeltas();
+ void ImplCreate();
+ void Create() { if( !pColumns ) ImplCreate(); }
+
+ sal_uInt16 GetSortListPos( SvPtrarr* pList, long nValue, int bVertical);
+ SvxIconChoiceCtrlEntry* SearchCol(
+ sal_uInt16 nCol,
+ sal_uInt16 nTop,
+ sal_uInt16 nBottom,
+ sal_uInt16 nPref,
+ sal_Bool bDown,
+ sal_Bool bSimple
+ );
+
+ SvxIconChoiceCtrlEntry* SearchRow(
+ sal_uInt16 nRow,
+ sal_uInt16 nRight,
+ sal_uInt16 nLeft,
+ sal_uInt16 nPref,
+ sal_Bool bRight,
+ sal_Bool bSimple
+ );
public:
- IcnCursor_Impl( SvxIconChoiceCtrl_Impl* pOwner );
- ~IcnCursor_Impl();
- void Clear();
+ IcnCursor_Impl( SvxIconChoiceCtrl_Impl* pOwner );
+ ~IcnCursor_Impl();
+ void Clear();
// fuer Cursortravelling usw.
SvxIconChoiceCtrlEntry* GoLeftRight( SvxIconChoiceCtrlEntry*, sal_Bool bRight );
@@ -576,8 +663,8 @@ public:
// sortierte Liste der Eintraege, die in ihr stehen. Eine Liste kann
// leer sein. Die Listen gehen in das Eigentum des Rufenden ueber und
// muessen mit DestroyGridAdjustData geloescht werden
- void CreateGridAjustData( SvPtrarr& pLists, SvxIconChoiceCtrlEntry* pRow=0);
- static void DestroyGridAdjustData( SvPtrarr& rLists );
+ void CreateGridAjustData( SvPtrarr& pLists, SvxIconChoiceCtrlEntry* pRow=0);
+ static void DestroyGridAdjustData( SvPtrarr& rLists );
};
// ----------------------------------------------------------------------------------------------
@@ -588,48 +675,46 @@ typedef sal_uLong GridId;
class IcnGridMap_Impl
{
- Rectangle _aLastOccupiedGrid;
+ Rectangle _aLastOccupiedGrid;
SvxIconChoiceCtrl_Impl* _pView;
- sal_Bool* _pGridMap;
- sal_uInt16 _nGridCols, _nGridRows;
+ sal_Bool* _pGridMap;
+ sal_uInt16 _nGridCols, _nGridRows;
- void Expand();
- void Create_Impl();
- void Create() { if(!_pGridMap) Create_Impl(); }
+ void Expand();
+ void Create_Impl();
+ void Create() { if(!_pGridMap) Create_Impl(); }
- void GetMinMapSize( sal_uInt16& rDX, sal_uInt16& rDY ) const;
+ void GetMinMapSize( sal_uInt16& rDX, sal_uInt16& rDY ) const;
public:
- IcnGridMap_Impl(SvxIconChoiceCtrl_Impl* pView);
- ~IcnGridMap_Impl();
-
- void Clear();
-
- GridId GetGrid( const Point& rDocPos, sal_Bool* pbClipped = 0 );
- GridId GetGrid( sal_uInt16 nGridX, sal_uInt16 nGridY );
- GridId GetUnoccupiedGrid( sal_Bool bOccupyFound=sal_True );
-
- void OccupyGrids( const Rectangle&, sal_Bool bOccupy = sal_True );
- void OccupyGrids( const SvxIconChoiceCtrlEntry*, sal_Bool bOccupy = sal_True );
- void OccupyGrid( GridId nId, sal_Bool bOccupy = sal_True )
- {
- DBG_ASSERT(!_pGridMap || nId<(sal_uLong)(_nGridCols*_nGridRows),"OccupyGrid: Bad GridId");
- if(_pGridMap && nId < (sal_uLong)(_nGridCols *_nGridRows) )
- _pGridMap[ nId ] = bOccupy;
- }
-
- Rectangle GetGridRect( GridId );
- void GetGridCoord( GridId, sal_uInt16& rGridX, sal_uInt16& rGridY );
- static sal_uLong GetGridCount( const Size& rSizePixel, sal_uInt16 nGridWidth, sal_uInt16 nGridHeight );
-
- void OutputSizeChanged();
+ IcnGridMap_Impl(SvxIconChoiceCtrl_Impl* pView);
+ ~IcnGridMap_Impl();
+
+ void Clear();
+
+ GridId GetGrid( const Point& rDocPos, sal_Bool* pbClipped = 0 );
+ GridId GetGrid( sal_uInt16 nGridX, sal_uInt16 nGridY );
+ GridId GetUnoccupiedGrid( sal_Bool bOccupyFound=sal_True );
+
+ void OccupyGrids( const SvxIconChoiceCtrlEntry*, sal_Bool bOccupy = sal_True );
+ void OccupyGrid( GridId nId, sal_Bool bOccupy = sal_True )
+ {
+ DBG_ASSERT(!_pGridMap || nId<(sal_uLong)(_nGridCols*_nGridRows),"OccupyGrid: Bad GridId");
+ if(_pGridMap && nId < (sal_uLong)(_nGridCols *_nGridRows) )
+ _pGridMap[ nId ] = bOccupy;
+ }
+
+ Rectangle GetGridRect( GridId );
+ void GetGridCoord( GridId, sal_uInt16& rGridX, sal_uInt16& rGridY );
+ static sal_uLong GetGridCount(
+ const Size& rSizePixel,
+ sal_uInt16 nGridWidth,
+ sal_uInt16 nGridHeight
+ );
+
+ void OutputSizeChanged();
};
-
-
-
-
#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx
index 640f6c5ae923..8602fa4cacfd 100644
--- a/svtools/source/contnr/imivctl1.cxx
+++ b/svtools/source/contnr/imivctl1.cxx
@@ -103,8 +103,10 @@ public:
sal_Bool IsGrabFocus() const { return bGrabFocus; }
};
-SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl( SvtIconChoiceCtrl* pCurView,
- WinBits nWinStyle ) :
+SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl(
+ SvtIconChoiceCtrl* pCurView,
+ WinBits nWinStyle
+) :
aEntries( this ),
aVerSBar( pCurView, WB_DRAG | WB_VSCROLL ),
aHorSBar( pCurView, WB_DRAG | WB_HSCROLL ),
@@ -129,7 +131,7 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl( SvtIconChoiceCtrl* pCurView,
bHighlightFramePressed = sal_False;
eSelectionMode = MULTIPLE_SELECTION;
pView = pCurView;
- pZOrderList = new List; //SvPtrarr;
+ pZOrderList = new SvxIconChoiceCtrlEntryList_impl();
ePositionMode = IcnViewPositionModeFree;
SetStyle( nWinStyle );
nFlags = 0;
@@ -218,19 +220,19 @@ void SvxIconChoiceCtrl_Impl::Clear( sal_Bool bInCtor )
nMaxVirtHeight = aSize.Height() - nHorSBarHeight;
if( nMaxVirtHeight <= 0 )
nMaxVirtHeight = DEFAULT_MAX_VIRT_HEIGHT;
- pZOrderList->Clear(); //Remove(0,pZOrderList->Count());
+ pZOrderList->clear();
SetOrigin( Point() );
if( bUpdateMode )
pView->Invalidate(INVALIDATE_NOCHILDREN);
}
AdjustScrollBars();
- sal_uLong nCount = aEntries.Count();
- for( sal_uLong nCur = 0; nCur < nCount; nCur++ )
+ size_t nCount = aEntries.size();
+ for( size_t nCur = 0; nCur < nCount; nCur++ )
{
- SvxIconChoiceCtrlEntry* pCur = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur );
+ SvxIconChoiceCtrlEntry* pCur = aEntries[ nCur ];
delete pCur;
}
- aEntries.Clear();
+ aEntries.clear();
DocRectChanged();
VisRectChanged();
}
@@ -292,19 +294,18 @@ void SvxIconChoiceCtrl_Impl::FontModified()
ShowCursor( sal_True );
}
-void SvxIconChoiceCtrl_Impl::InsertEntry( SvxIconChoiceCtrlEntry* pEntry, sal_uLong nPos,
+void SvxIconChoiceCtrl_Impl::InsertEntry( SvxIconChoiceCtrlEntry* pEntry, size_t nPos,
const Point* pPos )
{
StopEditTimer();
- aEntries.Insert( pEntry, nPos );
- if( (nFlags & F_ENTRYLISTPOS_VALID) && nPos >= aEntries.Count() - 1 )
- pEntry->nPos = aEntries.Count() - 1;
+ aEntries.insert( nPos, pEntry );
+ if( (nFlags & F_ENTRYLISTPOS_VALID) && nPos >= aEntries.size() - 1 )
+ pEntry->nPos = aEntries.size() - 1;
else
nFlags &= ~F_ENTRYLISTPOS_VALID;
- pZOrderList->Insert( (void*)pEntry, LIST_APPEND ); //pZOrderList->Count() );
+ pZOrderList->push_back( pEntry );
pImpCursor->Clear();
-// pGridMap->Clear();
if( pPos )
{
Size aSize( CalcBoundingSize( pEntry ) );
@@ -376,10 +377,10 @@ void SvxIconChoiceCtrl_Impl::SetListPositions()
if( nFlags & F_ENTRYLISTPOS_VALID )
return;
- sal_uLong nCount = aEntries.Count();
- for( sal_uLong nCur = 0; nCur < nCount; nCur++ )
+ size_t nCount = aEntries.size();
+ for( size_t nCur = 0; nCur < nCount; nCur++ )
{
- SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur );
+ SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ];
pEntry->nPos = nCur;
}
nFlags |= F_ENTRYLISTPOS_VALID;
@@ -408,7 +409,7 @@ void SvxIconChoiceCtrl_Impl::RemoveEntry( SvxIconChoiceCtrlEntry* pEntry )
if( pEntry->IsSelected() )
CallSelectHandler( 0 );
- if( aEntries.Count() == 1 && aEntries.GetObject(0) == pEntry )
+ if( aEntries.size() == 1 && aEntries[ 0 ] == pEntry )
{
Clear();
return;
@@ -435,21 +436,32 @@ void SvxIconChoiceCtrl_Impl::RemoveEntry( SvxIconChoiceCtrlEntry* pEntry )
}
sal_Bool bCurEntryPosValid = (nFlags & F_ENTRYLISTPOS_VALID) ? sal_True : sal_False;
- if( bCurEntryPosValid && aEntries.GetObject(aEntries.Count()-1) != pEntry )
+ if( bCurEntryPosValid && aEntries[ aEntries.size()-1 ] != pEntry )
nFlags &= ~F_ENTRYLISTPOS_VALID;
- sal_uLong nPos = pZOrderList->GetPos( (void*)pEntry );
- pZOrderList->Remove( nPos );
+
+ for (
+ SvxIconChoiceCtrlEntryList_impl::iterator it = pZOrderList->begin();
+ it < pZOrderList->end();
+ ++it
+ ) {
+ if ( *it == pEntry )
+ {
+ pZOrderList->erase( it );
+ break;
+ }
+ }
+
if( bCurEntryPosValid )
{
- DBG_ASSERT(aEntries.GetObject(pEntry->nPos)==pEntry,"RemoveEntry: Wrong nPos in entry");
- aEntries.Remove( pEntry->nPos );
+ DBG_ASSERT(aEntries[ pEntry->nPos ] == pEntry,"RemoveEntry: Wrong nPos in entry");
+ aEntries.remove( pEntry->nPos );
}
else
- aEntries.Remove( pEntry );
+ aEntries.remove( pEntry );
pImpCursor->Clear();
pGridMap->Clear();
delete pEntry;
- if( IsAutoArrange() && aEntries.Count() )
+ if( IsAutoArrange() && aEntries.size() )
aAutoArrangeTimer.Start();
if( bSetNewCursor )
{
@@ -544,10 +556,10 @@ void SvxIconChoiceCtrl_Impl::ResetVirtSize()
StopEditTimer();
aVirtOutputSize.Width() = 0;
aVirtOutputSize.Height() = 0;
- const sal_uLong nCount = aEntries.Count();
- for( sal_uLong nCur = 0; nCur < nCount; nCur++ )
+ const size_t nCount = aEntries.size();
+ for( size_t nCur = 0; nCur < nCount; nCur++ )
{
- SvxIconChoiceCtrlEntry* pCur = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur );
+ SvxIconChoiceCtrlEntry* pCur = aEntries[ nCur ];
pCur->ClearFlags( ICNVIEW_FLAG_POS_MOVED );
if( pCur->IsPosLocked() )
{
@@ -616,25 +628,25 @@ void SvxIconChoiceCtrl_Impl::AdjustVirtSize( const Rectangle& rRect )
void SvxIconChoiceCtrl_Impl::InitPredecessors()
{
DBG_ASSERT(!pHead,"SvxIconChoiceCtrl_Impl::InitPredecessors() >> Already initialized");
- sal_uLong nCount = aEntries.Count();
+ size_t nCount = aEntries.size();
if( nCount )
{
- SvxIconChoiceCtrlEntry* pPrev = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( 0 );
- for( sal_uLong nCur = 1; nCur <= nCount; nCur++ )
+ SvxIconChoiceCtrlEntry* pPrev = aEntries[ 0 ];
+ for( size_t nCur = 1; nCur <= nCount; nCur++ )
{
pPrev->ClearFlags( ICNVIEW_FLAG_POS_LOCKED | ICNVIEW_FLAG_POS_MOVED |
ICNVIEW_FLAG_PRED_SET);
SvxIconChoiceCtrlEntry* pNext;
if( nCur == nCount )
- pNext = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( 0 );
+ pNext = aEntries[ 0 ];
else
- pNext = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur );
+ pNext = aEntries[ nCur ];
pPrev->pflink = pNext;
pNext->pblink = pPrev;
pPrev = pNext;
}
- pHead = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( 0 );
+ pHead = aEntries[ 0 ];
}
else
pHead = 0;
@@ -645,10 +657,10 @@ void SvxIconChoiceCtrl_Impl::ClearPredecessors()
{
if( pHead )
{
- sal_uLong nCount = aEntries.Count();
- for( sal_uLong nCur = 0; nCur < nCount; nCur++ )
+ size_t nCount = aEntries.size();
+ for( size_t nCur = 0; nCur < nCount; nCur++ )
{
- SvxIconChoiceCtrlEntry* pCur = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur );
+ SvxIconChoiceCtrlEntry* pCur = aEntries[ nCur ];
pCur->pflink = 0;
pCur->pblink = 0;
pCur->ClearFlags( ICNVIEW_FLAG_PRED_SET );
@@ -750,7 +762,7 @@ void SvxIconChoiceCtrl_Impl::Paint( const Rectangle& rRect )
#endif
nFlags |= F_PAINTED;
- if( !aEntries.Count() )
+ if( !aEntries.size() )
return;
if( !pCursor )
{
@@ -767,14 +779,14 @@ void SvxIconChoiceCtrl_Impl::Paint( const Rectangle& rRect )
}
if( !bfound )
- pCursor = (SvxIconChoiceCtrlEntry*)aEntries.First();
+ pCursor = aEntries[ 0 ];
}
// Show Focus at Init-Time
if ( pView->HasFocus() )
GetFocus();
- sal_uLong nCount = pZOrderList->Count();
+ size_t nCount = pZOrderList->size();
if( !nCount )
return;
@@ -786,35 +798,33 @@ void SvxIconChoiceCtrl_Impl::Paint( const Rectangle& rRect )
pView->SetClipRegion( aOutputArea );
}
- const sal_uInt16 nListInitSize = aEntries.Count() > USHRT_MAX ?
- USHRT_MAX : (sal_uInt16)aEntries.Count();
- List* pNewZOrderList = new List( nListInitSize );
- List* pPaintedEntries = new List( nListInitSize );
+ SvxIconChoiceCtrlEntryList_impl* pNewZOrderList = new SvxIconChoiceCtrlEntryList_impl();
+ SvxIconChoiceCtrlEntryList_impl* pPaintedEntries = new SvxIconChoiceCtrlEntryList_impl();
- sal_uLong nPos = 0;
+ size_t nPos = 0;
while( nCount )
{
- SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)(pZOrderList->GetObject(nPos ));
+ SvxIconChoiceCtrlEntry* pEntry = (*pZOrderList)[ nPos ];
const Rectangle& rBoundRect = GetEntryBoundRect( pEntry );
if( rRect.IsOver( rBoundRect ) )
{
PaintEntry( pEntry, rBoundRect.TopLeft(), pView, sal_True );
// Eintraege, die neu gezeichnet werden, auf Top setzen
- pPaintedEntries->Insert( pEntry, LIST_APPEND );
+ pPaintedEntries->push_back( pEntry );
}
else
- pNewZOrderList->Insert( pEntry, LIST_APPEND );
+ pNewZOrderList->push_back( pEntry );
nCount--;
nPos++;
}
delete pZOrderList;
pZOrderList = pNewZOrderList;
- nCount = pPaintedEntries->Count();
+ nCount = pPaintedEntries->size();
if( nCount )
{
- for( sal_uLong nCur = 0; nCur < nCount; nCur++ )
- pZOrderList->Insert( pPaintedEntries->GetObject(nCur), LIST_APPEND);
+ for( size_t nCur = 0; nCur < nCount; nCur++ )
+ pZOrderList->push_back( (*pPaintedEntries)[ nCur ] );
}
delete pPaintedEntries;
@@ -824,7 +834,7 @@ void SvxIconChoiceCtrl_Impl::Paint( const Rectangle& rRect )
void SvxIconChoiceCtrl_Impl::RepaintEntries( sal_uInt16 nEntryFlagsMask )
{
- const sal_uLong nCount = pZOrderList->Count();
+ const size_t nCount = pZOrderList->size();
if( !nCount )
return;
@@ -835,9 +845,9 @@ void SvxIconChoiceCtrl_Impl::RepaintEntries( sal_uInt16 nEntryFlagsMask )
bResetClipRegion = sal_True;
pView->SetClipRegion( aOutRect );
}
- for( sal_uLong nCur = 0; nCur < nCount; nCur++ )
+ for( size_t nCur = 0; nCur < nCount; nCur++ )
{
- SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)(pZOrderList->GetObject(nCur));
+ SvxIconChoiceCtrlEntry* pEntry = (*pZOrderList)[ nCur ];
if( pEntry->GetFlags() & nEntryFlagsMask )
{
const Rectangle& rBoundRect = GetEntryBoundRect( pEntry );
@@ -1379,7 +1389,7 @@ sal_Bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt )
case KEY_END:
if( pCursor )
{
- pNewCursor = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( aEntries.Count() - 1 );
+ pNewCursor = aEntries[ aEntries.size() - 1 ];
SetCursor_Impl( pOldCursor, pNewCursor, bMod1, bShift, sal_True );
}
break;
@@ -1387,7 +1397,7 @@ sal_Bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt )
case KEY_HOME:
if( pCursor )
{
- pNewCursor = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( 0 );
+ pNewCursor = aEntries[ 0 ];
SetCursor_Impl( pOldCursor, pNewCursor, bMod1, bShift, sal_True );
}
break;
@@ -1598,11 +1608,11 @@ sal_Bool SvxIconChoiceCtrl_Impl::CheckHorScrollBar()
if(!( nWinBits & WB_HSCROLL) && !aOrigin.X() )
{
long nWidth = aOutputSize.Width();
- const sal_uLong nCount = pZOrderList->Count();
+ const size_t nCount = pZOrderList->size();
long nMostRight = 0;
- for( sal_uLong nCur = 0; nCur < nCount; nCur++ )
+ for( size_t nCur = 0; nCur < nCount; nCur++ )
{
- SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)pZOrderList->GetObject(nCur);
+ SvxIconChoiceCtrlEntry* pEntry = (*pZOrderList)[ nCur ];
long nRight = GetEntryBoundRect(pEntry).Right();
if( nRight > nWidth )
return sal_False;
@@ -1637,10 +1647,10 @@ sal_Bool SvxIconChoiceCtrl_Impl::CheckVerScrollBar()
{
long nDeepest = 0;
long nHeight = aOutputSize.Height();
- const sal_uLong nCount = pZOrderList->Count();
- for( sal_uLong nCur = 0; nCur < nCount; nCur++ )
+ const size_t nCount = pZOrderList->size();
+ for( size_t nCur = 0; nCur < nCount; nCur++ )
{
- SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)pZOrderList->GetObject(nCur);
+ SvxIconChoiceCtrlEntry* pEntry = (*pZOrderList)[ nCur ];
long nBottom = GetEntryBoundRect(pEntry).Bottom();
if( nBottom > nHeight )
return sal_False;
@@ -2099,11 +2109,11 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetEntry( const Point& rDocPos,
{
CheckBoundingRects();
// Z-Order-Liste vom Ende her absuchen
- sal_uLong nCount = pZOrderList->Count();
+ size_t nCount = pZOrderList->size();
while( nCount )
{
nCount--;
- SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)(pZOrderList->GetObject(nCount));
+ SvxIconChoiceCtrlEntry* pEntry = (*pZOrderList)[ nCount ];
if( pEntry->aRect.IsInside( rDocPos ) )
{
if( bHit )
@@ -2126,45 +2136,32 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetEntry( const Point& rDocPos,
return 0;
}
-SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetNextEntry( const Point& rDocPos, SvxIconChoiceCtrlEntry* pCurEntry )
-{
+SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetNextEntry(
+ const Point& rDocPos,
+ SvxIconChoiceCtrlEntry* pCurEntry
+) {
CheckBoundingRects();
SvxIconChoiceCtrlEntry* pTarget = 0;
- const sal_uLong nStartPos = pZOrderList->GetPos( (void*)pCurEntry );
- if( nStartPos != LIST_ENTRY_NOTFOUND )
- {
- const sal_uLong nCount = pZOrderList->Count();
- for( sal_uLong nCur = nStartPos+1; nCur < nCount; nCur++ )
+
+ for (
+ SvxIconChoiceCtrlEntryList_impl::iterator it = pZOrderList->begin();
+ it < pZOrderList->end();
+ ++it
+ ) {
+ if ( *it == pCurEntry )
{
- SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)(pZOrderList->GetObject(nCur));
- if( pEntry->aRect.IsInside( rDocPos ) )
+ while ( ++it < pZOrderList->end() )
{
- pTarget = pEntry;
- break;
+ if ( (*it)->aRect.IsInside( rDocPos ) )
+ {
+ pTarget = *it;
+ break;
+ }
}
+ break;
}
}
- return pTarget;
-}
-SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetPrevEntry( const Point& rDocPos, SvxIconChoiceCtrlEntry* pCurEntry )
-{
- CheckBoundingRects();
- SvxIconChoiceCtrlEntry* pTarget = 0;
- sal_uLong nStartPos = pZOrderList->GetPos( (void*)pCurEntry );
- if( nStartPos != LIST_ENTRY_NOTFOUND && nStartPos != 0 )
- {
- nStartPos--;
- do
- {
- SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)(pZOrderList->GetObject(nStartPos));
- if( pEntry->aRect.IsInside( rDocPos ) )
- {
- pTarget = pEntry;
- break;
- }
- } while( nStartPos > 0 );
- }
return pTarget;
}
@@ -2344,18 +2341,18 @@ Size SvxIconChoiceCtrl_Impl::CalcBoundingSize( SvxIconChoiceCtrlEntry* pEntry )
void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRects()
{
nMaxBoundHeight = 0;
- pZOrderList->Clear();
- sal_uLong nCount = aEntries.Count();
- sal_uLong nCur;
+ pZOrderList->clear();
+ size_t nCount = aEntries.size();
+ size_t nCur;
SvxIconChoiceCtrlEntry* pEntry;
if( !IsAutoArrange() || !pHead )
{
for( nCur = 0; nCur < nCount; nCur++ )
{
- pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur );
+ pEntry = aEntries[ nCur ];
FindBoundingRect( pEntry );
- pZOrderList->Insert( pEntry, LIST_APPEND );
+ pZOrderList->push_back( pEntry );
}
}
else
@@ -2366,7 +2363,7 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRects()
{
DBG_ASSERT(pEntry->pflink&&pEntry->pblink,"SvxIconChoiceCtrl_Impl::RecalcAllBoundingRect > Bad link(s)");
FindBoundingRect( pEntry );
- pZOrderList->Insert( pEntry, pZOrderList->Count() );
+ pZOrderList->push_back( pEntry );
pEntry = pEntry->pflink;
nCur++;
}
@@ -2378,16 +2375,16 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRects()
void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRectsSmart()
{
nMaxBoundHeight = 0;
- pZOrderList->Clear();
- sal_uLong nCur;
+ pZOrderList->clear();
+ size_t nCur;
SvxIconChoiceCtrlEntry* pEntry;
- const sal_uLong nCount = aEntries.Count();
+ const size_t nCount = aEntries.size();
if( !IsAutoArrange() || !pHead )
{
for( nCur = 0; nCur < nCount; nCur++ )
{
- pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur );
+ pEntry = aEntries[ nCur ];
if( IsBoundingRectValid( pEntry->aRect ))
{
Size aBoundSize( pEntry->aRect.GetSize() );
@@ -2396,7 +2393,7 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRectsSmart()
}
else
FindBoundingRect( pEntry );
- pZOrderList->Insert( pEntry, LIST_APPEND );
+ pZOrderList->push_back( pEntry );
}
}
else
@@ -2414,7 +2411,7 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRectsSmart()
}
else
FindBoundingRect( pEntry );
- pZOrderList->Insert( pEntry, LIST_APPEND );
+ pZOrderList->push_back( pEntry );
pEntry = pEntry->pflink;
nCur++;
}
@@ -2424,10 +2421,10 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRectsSmart()
void SvxIconChoiceCtrl_Impl::UpdateBoundingRects()
{
- const sal_uLong nCount = aEntries.Count();
- for( sal_uLong nCur = 0; nCur < nCount; nCur++ )
+ const size_t nCount = aEntries.size();
+ for( size_t nCur = 0; nCur < nCount; nCur++ )
{
- SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur );
+ SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ];
GetEntryBoundRect( pEntry );
}
}
@@ -2754,25 +2751,28 @@ void SvxIconChoiceCtrl_Impl::Command( const CommandEvent& rCEvt )
(rCEvt.GetCommand() == COMMAND_STARTAUTOSCROLL) ||
(rCEvt.GetCommand() == COMMAND_AUTOSCROLL) )
{
-#if 1
if( HandleScrollCommand( rCEvt ) )
return;
-#else
- ScrollBar* pHor = aHorSBar.IsVisible() ? &aHorSBar : 0;
- ScrollBar* pVer = aVerSBar.IsVisible() ? &aVerSBar : 0;
- if( pView->HandleScrollCommand( rCEvt, pHor, pVer ) )
- return;
-#endif
}
}
void SvxIconChoiceCtrl_Impl::ToTop( SvxIconChoiceCtrlEntry* pEntry )
{
- if( pZOrderList->GetObject( pZOrderList->Count() - 1 ) != pEntry )
- {
- sal_uLong nPos = pZOrderList->GetPos( (void*)pEntry );
- pZOrderList->Remove( nPos );
- pZOrderList->Insert( pEntry, LIST_APPEND );
+ if( !pZOrderList->empty()
+ && pEntry != pZOrderList->back()
+ ) {
+ for(
+ SvxIconChoiceCtrlEntryList_impl::iterator it = pZOrderList->begin();
+ it < pZOrderList->end();
+ ++it
+ ) {
+ if ( *it == pEntry )
+ {
+ pZOrderList->erase( it );
+ pZOrderList->push_back( pEntry );
+ break;
+ }
+ }
}
}
@@ -2913,7 +2913,7 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::FindNewCursor()
}
}
else
- pNewCursor = (SvxIconChoiceCtrlEntry*)aEntries.First();
+ pNewCursor = aEntries[ 0 ];
DBG_ASSERT(!pNewCursor|| (pCursor&&pCursor!=pNewCursor),"FindNewCursor failed");
return pNewCursor;
}
@@ -2942,10 +2942,10 @@ void SvxIconChoiceCtrl_Impl::DeselectAllBut( SvxIconChoiceCtrlEntry* pThisEntryN
//
// !!!!!!! Todo: Evtl. Z-Orderlist abarbeiten !!!!!!!
//
- sal_uLong nCount = aEntries.Count();
- for( sal_uLong nCur = 0; nCur < nCount; nCur++ )
+ size_t nCount = aEntries.size();
+ for( size_t nCur = 0; nCur < nCount; nCur++ )
{
- SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur );
+ SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ];
if( pEntry != pThisEntryNot && pEntry->IsSelected() )
SelectEntry( pEntry, sal_False, sal_True, sal_True, bPaintSync );
}
@@ -3148,7 +3148,7 @@ void SvxIconChoiceCtrl_Impl::SelectRect( const Rectangle& rRect, sal_Bool bAdd,
SvPtrarr* pOtherRects )
{
aCurSelectionRect = rRect;
- if( !pZOrderList || !pZOrderList->Count() )
+ if( !pZOrderList || !pZOrderList->size() )
return;
// Flag setzen, damit im Select kein ToTop gerufen wird
@@ -3157,7 +3157,7 @@ void SvxIconChoiceCtrl_Impl::SelectRect( const Rectangle& rRect, sal_Bool bAdd,
CheckBoundingRects();
pView->Update();
- const sal_uLong nCount = pZOrderList->Count();
+ const size_t nCount = pZOrderList->size();
Rectangle aRect( rRect );
aRect.Justify();
@@ -3170,9 +3170,9 @@ void SvxIconChoiceCtrl_Impl::SelectRect( const Rectangle& rRect, sal_Bool bAdd,
pView->SetClipRegion( GetOutputRect() );
}
- for( sal_uLong nPos = 0; nPos < nCount; nPos++ )
+ for( size_t nPos = 0; nPos < nCount; nPos++ )
{
- SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)(pZOrderList->GetObject(nPos ));
+ SvxIconChoiceCtrlEntry* pEntry = (*pZOrderList)[ nPos ];
if( !IsBoundingRectValid( pEntry->aRect ))
FindBoundingRect( pEntry );
@@ -3612,8 +3612,8 @@ sal_Bool SvxIconChoiceCtrl_Impl::IsMnemonicChar( sal_Unicode cChar, sal_uLong& r
{
sal_Bool bRet = sal_False;
const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper();
- sal_uLong nEntryCount = GetEntryCount();
- for ( sal_uLong i = 0; i < nEntryCount; ++i )
+ size_t nEntryCount = GetEntryCount();
+ for ( size_t i = 0; i < nEntryCount; ++i )
{
if ( rI18nHelper.MatchMnemonic( GetEntry( i )->GetText(), cChar ) )
{
@@ -3758,12 +3758,12 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetFirstSelectedEntry( sal_uLong
return pCurHighlightFrame;
}
- sal_uLong nCount = aEntries.Count();
+ size_t nCount = aEntries.size();
if( !pHead )
{
- for( sal_uLong nCur = 0; nCur < nCount; nCur++ )
+ for( size_t nCur = 0; nCur < nCount; nCur++ )
{
- SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur );
+ SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ];
if( pEntry->IsSelected() )
{
rPos = nCur;
@@ -3795,14 +3795,14 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetFirstSelectedEntry( sal_uLong
// kein Round Robin!
SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetNextSelectedEntry( sal_uLong& rStartPos ) const
{
- sal_uLong nCount = aEntries.Count();
+ size_t nCount = aEntries.size();
if( rStartPos > nCount || !GetSelectionCount() )
return 0;
if( !pHead )
{
- for( sal_uLong nCur = rStartPos+1; nCur < nCount; nCur++ )
+ for( size_t nCur = rStartPos+1; nCur < nCount; nCur++ )
{
- SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur );
+ SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ];
if( pEntry->IsSelected() )
{
rStartPos = nCur;
@@ -3812,7 +3812,7 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetNextSelectedEntry( sal_uLong&
}
else
{
- SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( rStartPos );
+ SvxIconChoiceCtrlEntry* pEntry = aEntries[ rStartPos ];
pEntry = pEntry->pflink;
while( pEntry != pHead )
{
@@ -3833,10 +3833,10 @@ void SvxIconChoiceCtrl_Impl::SelectAll( sal_Bool bSelect, sal_Bool bPaint )
{
bPaint = sal_True;
- sal_uLong nCount = aEntries.Count();
- for( sal_uLong nCur = 0; nCur < nCount && (bSelect || GetSelectionCount() ); nCur++ )
+ size_t nCount = aEntries.size();
+ for( size_t nCur = 0; nCur < nCount && (bSelect || GetSelectionCount() ); nCur++ )
{
- SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur );
+ SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ];
SelectEntry( pEntry, bSelect, sal_True, sal_True, bPaint );
}
nFlags &= (~F_ADD_MODE);
@@ -3993,13 +3993,13 @@ sal_uLong SvxIconChoiceCtrl_Impl::GetEntryListPos( SvxIconChoiceCtrlEntry* pEntr
void SvxIconChoiceCtrl_Impl::SetEntryListPos( SvxIconChoiceCtrlEntry* pListEntry, sal_uLong nNewPos )
{
- sal_uLong nCurPos = GetEntryListPos( pListEntry );
+ size_t nCurPos = GetEntryListPos( pListEntry );
if( nCurPos == nNewPos )
return;
- aEntries.List::Remove( nCurPos );
- aEntries.List::Insert( (void*)pListEntry, nNewPos );
+ aEntries.remove( nCurPos );
+ aEntries.insert( nNewPos, pListEntry );
// Eintragspositionen anpassen
- sal_uLong nStart, nEnd;
+ size_t nStart, nEnd;
if( nNewPos < nCurPos )
{
nStart = nNewPos;
@@ -4012,7 +4012,7 @@ void SvxIconChoiceCtrl_Impl::SetEntryListPos( SvxIconChoiceCtrlEntry* pListEntry
}
for( ; nStart <= nEnd; nStart++ )
{
- SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nStart );
+ SvxIconChoiceCtrlEntry* pEntry = aEntries[ nStart ];
pEntry->nPos = nStart;
}
}
@@ -4080,15 +4080,7 @@ void SvxIconChoiceCtrl_Impl::InitSettings()
}
}
-EntryList_Impl::EntryList_Impl( SvxIconChoiceCtrl_Impl* pOwner, sal_uInt16 _nInitSize , sal_uInt16 _nReSize ) :
- List( _nInitSize, _nReSize ),
- _pOwner( pOwner )
-{
- _pOwner->pHead = 0;
-}
-
-EntryList_Impl::EntryList_Impl( SvxIconChoiceCtrl_Impl* pOwner, sal_uInt16 _nBlockSize, sal_uInt16 _nInitSize, sal_uInt16 _nReSize ) :
- List( _nBlockSize, _nInitSize, _nReSize ),
+EntryList_Impl::EntryList_Impl( SvxIconChoiceCtrl_Impl* pOwner ) :
_pOwner( pOwner )
{
_pOwner->pHead = 0;
@@ -4099,31 +4091,47 @@ EntryList_Impl::~EntryList_Impl()
_pOwner->pHead = 0;
}
-void EntryList_Impl::Clear()
+void EntryList_Impl::clear()
{
_pOwner->pHead = 0;
- List::Clear();
+ maIconChoiceCtrlEntryList.clear();
}
-void EntryList_Impl::Insert( SvxIconChoiceCtrlEntry* pEntry, sal_uLong nPos )
+void EntryList_Impl::insert( size_t nPos, SvxIconChoiceCtrlEntry* pEntry )
{
- List::Insert( pEntry, nPos );
+ if ( nPos < maIconChoiceCtrlEntryList.size() ) {
+ maIconChoiceCtrlEntryList.insert( maIconChoiceCtrlEntryList.begin() + nPos, pEntry );
+ } else {
+ maIconChoiceCtrlEntryList.push_back( pEntry );
+ }
if( _pOwner->pHead )
pEntry->SetBacklink( _pOwner->pHead->pblink );
}
-SvxIconChoiceCtrlEntry* EntryList_Impl::Remove( sal_uLong nPos )
+SvxIconChoiceCtrlEntry* EntryList_Impl::remove( size_t nPos )
{
- SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)List::Remove( nPos );
- DBG_ASSERT(pEntry,"EntryList_Impl::Remove > Entry not found");
- Removed_Impl( pEntry );
+ SvxIconChoiceCtrlEntry* pEntry = NULL;
+ if ( nPos < maIconChoiceCtrlEntryList.size() ) {
+ pEntry = maIconChoiceCtrlEntryList[ nPos ];
+ maIconChoiceCtrlEntryList.erase( maIconChoiceCtrlEntryList.begin() + nPos );
+ Removed_Impl( pEntry );
+ }
return pEntry;
}
-void EntryList_Impl::Remove( SvxIconChoiceCtrlEntry* pEntry )
+void EntryList_Impl::remove( SvxIconChoiceCtrlEntry* pEntry )
{
- List::Remove( (void*)pEntry );
- Removed_Impl( pEntry );
+ for (
+ SvxIconChoiceCtrlEntryList_impl::iterator it = maIconChoiceCtrlEntryList.begin();
+ it < maIconChoiceCtrlEntryList.end();
+ ++it
+ ) {
+ if ( *it == pEntry ) {
+ maIconChoiceCtrlEntryList.erase( it );
+ Removed_Impl( pEntry );
+ break;
+ }
+ }
}
void EntryList_Impl::Removed_Impl( SvxIconChoiceCtrlEntry* pEntry )
@@ -4136,7 +4144,7 @@ void EntryList_Impl::Removed_Impl( SvxIconChoiceCtrlEntry* pEntry )
_pOwner->pHead = pEntry->pflink;
else
{
- DBG_ASSERT(!Count(),"EntryList_Impl::Remove > Invalid predecessor" );
+ DBG_ASSERT(!size(),"EntryList_Impl::Remove > Invalid predecessor" );
_pOwner->pHead = 0;
}
}
@@ -4146,14 +4154,14 @@ void EntryList_Impl::Removed_Impl( SvxIconChoiceCtrlEntry* pEntry )
void SvxIconChoiceCtrl_Impl::SetPositionMode( SvxIconChoiceCtrlPositionMode eMode )
{
- sal_uLong nCur;
+ size_t nCur;
if( eMode == ePositionMode )
return;
SvxIconChoiceCtrlPositionMode eOldMode = ePositionMode;
ePositionMode = eMode;
- sal_uLong nCount = aEntries.Count();
+ size_t nCount = aEntries.size();
if( eOldMode == IcnViewPositionModeAutoArrange )
{
@@ -4161,7 +4169,7 @@ void SvxIconChoiceCtrl_Impl::SetPositionMode( SvxIconChoiceCtrlPositionMode eMod
// mit ungewollten Ueberlappungen, da diese Eintrage im Arrange
// nicht beruecksichtigt werden.
#if 1
- if( aEntries.Count() )
+ if( aEntries.size() )
aAutoArrangeTimer.Start();
#else
if( pHead )
@@ -4188,7 +4196,7 @@ void SvxIconChoiceCtrl_Impl::SetPositionMode( SvxIconChoiceCtrlPositionMode eMod
List aMovedEntries;
for( nCur = 0; nCur < nCount; nCur++ )
{
- SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur );
+ SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ];
if( pEntry->GetFlags() & (ICNVIEW_FLAG_POS_LOCKED | ICNVIEW_FLAG_POS_MOVED))
{
SvxIconChoiceCtrlEntry_Impl* pE = new SvxIconChoiceCtrlEntry_Impl(
@@ -4204,7 +4212,7 @@ void SvxIconChoiceCtrl_Impl::SetPositionMode( SvxIconChoiceCtrlPositionMode eMod
}
for( nCur = 0; nCur < nCount; nCur++ )
delete (SvxIconChoiceCtrlEntry_Impl*)aMovedEntries.GetObject( nCur );
- if( aEntries.Count() )
+ if( aEntries.size() )
aAutoArrangeTimer.Start();
}
else if( ePositionMode == IcnViewPositionModeAutoAdjust )
@@ -4274,7 +4282,7 @@ sal_Bool SvxIconChoiceCtrl_Impl::GetEntryPredecessor( SvxIconChoiceCtrlEntry* pE
if( pEntry == pHead )
{
- SvxIconChoiceCtrlEntry* pFirst = (SvxIconChoiceCtrlEntry*)aEntries.GetObject(0);
+ SvxIconChoiceCtrlEntry* pFirst = aEntries[ 0 ];
if( pFirst != pEntry )
return sal_True;
return sal_False;
@@ -4293,13 +4301,13 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::FindEntryPredecessor( SvxIconCho
Rectangle aCenterRect( CalcBmpRect( pEntry, &aPos ));
Point aNewPos( aCenterRect.Center() );
sal_uLong nGrid = GetPredecessorGrid( aNewPos );
- sal_uLong nCount = aEntries.Count();
+ size_t nCount = aEntries.size();
if( nGrid == ULONG_MAX )
return 0;
if( nGrid >= nCount )
nGrid = nCount - 1;
if( !pHead )
- return (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nGrid );
+ return aEntries[ nGrid ];
SvxIconChoiceCtrlEntry* pCur = pHead; // Grid 0
// todo: Liste von hinten aufrollen wenn nGrid > nCount/2
diff --git a/svtools/source/contnr/imivctl2.cxx b/svtools/source/contnr/imivctl2.cxx
index 93e2990d6658..1b0575fbd9bd 100644
--- a/svtools/source/contnr/imivctl2.cxx
+++ b/svtools/source/contnr/imivctl2.cxx
@@ -85,10 +85,10 @@ void IcnCursor_Impl::ImplCreate()
pColumns = new SvPtrarr[ nCols ];
pRows = new SvPtrarr[ nRows ];
- sal_uLong nCount = pView->aEntries.Count();
- for( sal_uLong nCur = 0; nCur < nCount; nCur++ )
+ size_t nCount = pView->aEntries.size();
+ for( size_t nCur = 0; nCur < nCount; nCur++ )
{
- SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( nCur );
+ SvxIconChoiceCtrlEntry* pEntry = pView->aEntries[ nCur ];
// const Rectangle& rRect = pView->GetEntryBoundRect( pEntry );
Rectangle rRect( pView->CalcBmpRect( pEntry,0 ) );
short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / nDeltaHeight );
@@ -357,8 +357,8 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::GoPageUpDown( SvxIconChoiceCtrlEntry* pS
if( bDown )
{
nNewPos += nEntriesInView;
- if( nNewPos >= (long)pView->aEntries.Count() )
- nNewPos = pView->aEntries.Count() - 1;
+ if( nNewPos >= (long)pView->aEntries.size() )
+ nNewPos = pView->aEntries.size() - 1;
}
else
{
@@ -367,7 +367,7 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::GoPageUpDown( SvxIconChoiceCtrlEntry* pS
nNewPos = 0;
}
if( nPos != nNewPos )
- return (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( (sal_uLong)nNewPos );
+ return pView->aEntries[ (size_t)nNewPos ];
return 0;
}
long nOpt = pView->GetEntryBoundRect( pStart ).Top();
@@ -410,10 +410,10 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::GoUpDown( SvxIconChoiceCtrlEntry* pCtrlE
if( pView->IsAutoArrange() && !(pView->nWinBits & WB_ALIGN_TOP) )
{
sal_uLong nPos = pView->GetEntryListPos( pCtrlEntry );
- if( bDown && nPos < (pView->aEntries.Count() - 1) )
- return (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( nPos + 1 );
+ if( bDown && nPos < (pView->aEntries.size() - 1) )
+ return pView->aEntries[ nPos + 1 ];
else if( !bDown && nPos > 0 )
- return (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( nPos - 1 );
+ return pView->aEntries[ nPos - 1 ];
return 0;
}
@@ -504,10 +504,10 @@ void IcnCursor_Impl::CreateGridAjustData( SvPtrarr& rLists, SvxIconChoiceCtrlEnt
SvPtrarr* pRow = new SvPtrarr;
rLists.Insert( (void*)pRow, nCurList );
}
- const sal_uLong nCount = pView->aEntries.Count();
- for( sal_uLong nCur = 0; nCur < nCount; nCur++ )
+ const size_t nCount = pView->aEntries.size();
+ for( size_t nCur = 0; nCur < nCount; nCur++ )
{
- SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( nCur );
+ SvxIconChoiceCtrlEntry* pEntry = pView->aEntries[ nCur ];
const Rectangle& rRect = pView->GetEntryBoundRect( pEntry );
short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / pView->nGridDY );
sal_uInt16 nIns = GetSortListPos((SvPtrarr*)rLists[nY],rRect.Left(),sal_False);
@@ -523,10 +523,10 @@ void IcnCursor_Impl::CreateGridAjustData( SvPtrarr& rLists, SvxIconChoiceCtrlEnt
short nRefRow = (short)( ((rRefRect.Top()+rRefRect.Bottom())/2) / pView->nGridDY );
SvPtrarr* pRow = new SvPtrarr;
rLists.Insert( (void*)pRow, 0 );
- sal_uLong nCount = pView->aEntries.Count();
- for( sal_uLong nCur = 0; nCur < nCount; nCur++ )
+ size_t nCount = pView->aEntries.size();
+ for( size_t nCur = 0; nCur < nCount; nCur++ )
{
- SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( nCur );
+ SvxIconChoiceCtrlEntry* pEntry = pView->aEntries[ nCur ];
Rectangle rRect( pView->CalcBmpRect(pEntry) );
//const Rectangle& rRect = pView->GetEntryBoundRect( pEntry );
short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / pView->nGridDY );
@@ -601,9 +601,9 @@ void IcnGridMap_Impl::Create_Impl()
_pGridMap = new sal_Bool[ _nGridRows * _nGridCols];
memset( (void*)_pGridMap, 0, _nGridRows * _nGridCols );
- const sal_uLong nCount = _pView->aEntries.Count();
- for( sal_uLong nCur=0; nCur < nCount; nCur++ )
- OccupyGrids( (SvxIconChoiceCtrlEntry*)_pView->aEntries.GetObject( nCur ));
+ const size_t nCount = _pView->aEntries.size();
+ for( size_t nCur=0; nCur < nCount; nCur++ )
+ OccupyGrids( _pView->aEntries[ nCur ] );
}
void IcnGridMap_Impl::GetMinMapSize( sal_uInt16& rDX, sal_uInt16& rDY ) const
@@ -728,60 +728,11 @@ GridId IcnGridMap_Impl::GetUnoccupiedGrid( sal_Bool bOccupyFound )
// ein Eintrag belegt nur das unter seinem Zentrum liegende GridRect
// diese Variante ist bedeutend schneller als die Belegung ueber das
// Bounding-Rect, kann aber zu kleinen Ueberlappungen fuehren
-#define OCCUPY_CENTER
-
void IcnGridMap_Impl::OccupyGrids( const SvxIconChoiceCtrlEntry* pEntry, sal_Bool bOccupy )
{
if( !_pGridMap || !_pView->IsBoundingRectValid( pEntry->aRect ))
return;
-#ifndef OCCUPY_CENTER
- OccupyGrids( pEntry->aRect, bOccupy );
-#else
OccupyGrid( GetGrid( pEntry->aRect.Center()), bOccupy );
-#endif
-
-}
-
-void IcnGridMap_Impl::OccupyGrids( const Rectangle& rRect, sal_Bool bUsed )
-{
- if( !_pGridMap )
- return;
-
- if( bUsed )
- {
- if( _aLastOccupiedGrid == rRect )
- return;
- _aLastOccupiedGrid = rRect;
- }
- else
- _aLastOccupiedGrid.SetEmpty();
-
- sal_Bool bTopLeftClipped, bBottomRightClipped;
- GridId nIdTL = GetGrid( rRect.TopLeft(), &bTopLeftClipped );
- GridId nIdBR = GetGrid( rRect.BottomRight(), &bBottomRightClipped );
-
- if( bTopLeftClipped && bBottomRightClipped )
- return;
-
- sal_uInt16 nX1,nX2,nY1,nY2;
- GetGridCoord( nIdTL, nX1, nY1 );
- GetGridCoord( nIdBR, nX2, nY2 );
- sal_uInt16 nTemp;
- if( nX1 > nX2 )
- {
- nTemp = nX1;
- nX1 = nX2;
- nX2 = nTemp;
- }
- if( nY1 > nY2 )
- {
- nTemp = nY1;
- nY1 = nY2;
- nY2 = nTemp;
- }
- for( ; nX1 <= nX2; nX1++ )
- for( ; nY1 <= nY2; nY1++ )
- OccupyGrid( GetGrid( nX1, nY1 ) );
}
void IcnGridMap_Impl::Clear()
diff --git a/svtools/source/contnr/ivctrl.cxx b/svtools/source/contnr/ivctrl.cxx
index f26de38cc1ab..7f1b374cb34a 100644
--- a/svtools/source/contnr/ivctrl.cxx
+++ b/svtools/source/contnr/ivctrl.cxx
@@ -360,12 +360,6 @@ SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::GetNextEntry( const Point& rPixPos, S
return ((SvtIconChoiceCtrl*)this)->_pImp->GetNextEntry( aPos, pCurEntry );
}
-SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::GetPrevEntry( const Point& rPixPos, SvxIconChoiceCtrlEntry* pCurEntry, sal_Bool ) const
-{
- Point aPos( rPixPos );
- aPos -= GetMapMode().GetOrigin();
- return ((SvtIconChoiceCtrl*)this)->_pImp->GetPrevEntry( aPos, pCurEntry );
-}
sal_uLong SvtIconChoiceCtrl::GetEntryCount() const
{
return _pImp->GetEntryCount();
diff --git a/svtools/source/contnr/svicnvw.cxx b/svtools/source/contnr/svicnvw.cxx
deleted file mode 100644
index 41d6a100c1f3..000000000000
--- a/svtools/source/contnr/svicnvw.cxx
+++ /dev/null
@@ -1,813 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-
-#include <svtools/svlbox.hxx>
-#include <svtools/svicnvw.hxx>
-#include <svimpicn.hxx>
-#include <svtools/svlbitm.hxx>
-
-#define ICNVW_BLOCK_ENTRYINS 0x0001
-
-SvIcnVwDataEntry::SvIcnVwDataEntry()
- : nIcnVwFlags(0),eTextMode(ShowTextDontKnow)
-{
-}
-
-SvIcnVwDataEntry::~SvIcnVwDataEntry()
-{
-}
-
-SvIconView::SvIconView( Window* pParent, WinBits nWinStyle ) :
- SvLBox( pParent, nWinStyle | WB_BORDER )
-{
- nIcnVwFlags = 0;
- pImp = new SvImpIconView( this, GetModel(), nWinStyle | WB_ICON );
- pImp->mpViewData = 0;
- SetSelectionMode( SINGLE_SELECTION );
- SetLineColor();
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- SetBackground( Wallpaper( rStyleSettings.GetFieldColor() ) );
- SetDefaultFont();
-}
-
-SvIconView::SvIconView( Window* pParent , const ResId& rResId ) :
- SvLBox( pParent, rResId )
-{
- pImp = new SvImpIconView( this, GetModel(), WB_BORDER | WB_ICON );
- nIcnVwFlags = 0;
- pImp->mpViewData = 0;
- SetLineColor();
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- SetBackground( Wallpaper( rStyleSettings.GetFieldColor() ) );
- SetDefaultFont();
- pImp->SetSelectionMode( GetSelectionMode() );
-}
-
-SvIconView::~SvIconView()
-{
- delete pImp;
-}
-
-void SvIconView::SetDefaultFont()
-{
- SetFont( GetFont() );
-}
-
-SvLBoxEntry* SvIconView::CreateEntry( const XubString& rStr,
- const Image& rCollEntryBmp, const Image& rExpEntryBmp )
-{
- SvLBoxEntry* pEntry = new SvLBoxEntry;
-
- SvLBoxContextBmp* pContextBmp =
- new SvLBoxContextBmp( pEntry,0, rCollEntryBmp,rExpEntryBmp, 0xffff );
- pEntry->AddItem( pContextBmp );
-
- SvLBoxString* pString = new SvLBoxString( pEntry, 0, rStr );
- pEntry->AddItem( pString );
-
- return pEntry;
-}
-
-void SvIconView::DisconnectFromModel()
-{
- SvLBox::DisconnectFromModel();
- pImp->SetModel( GetModel(), 0 );
-}
-
-
-SvLBoxEntry* SvIconView::InsertEntry( const XubString& rText,
- SvLBoxEntry* pParent, sal_Bool bChildsOnDemand, sal_uLong nPos )
-{
- SvLBoxEntry* pEntry = CreateEntry(
- rText, aCollapsedEntryBmp, aExpandedEntryBmp );
- pEntry->EnableChildsOnDemand( bChildsOnDemand );
-
- if ( !pParent )
- SvLBox::Insert( pEntry, nPos );
- else
- SvLBox::Insert( pEntry, pParent, nPos );
- return pEntry;
-}
-
-SvLBoxEntry* SvIconView::InsertEntry( const XubString& rText,
- const Image& rExpEntryBmp,
- const Image& rCollEntryBmp,
- SvLBoxEntry* pParent, sal_Bool bChildsOnDemand, sal_uLong nPos)
-{
- SvLBoxEntry* pEntry = CreateEntry(
- rText, rCollEntryBmp, rExpEntryBmp );
-
- pEntry->EnableChildsOnDemand( bChildsOnDemand );
- if ( !pParent )
- SvLBox::Insert( pEntry, nPos );
- else
- SvLBox::Insert( pEntry, pParent, nPos );
- return pEntry;
-}
-
-
-void SvIconView::SetEntryText(SvLBoxEntry* pEntry, const XubString& rStr)
-{
- SvLBoxString* pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
- if ( pItem )
- {
- pItem->SetText( pEntry, rStr );
- GetModel()->InvalidateEntry( pEntry );
- }
-}
-
-void SvIconView::SetExpandedEntryBmp(SvLBoxEntry* pEntry, const Image& rBmp)
-{
- SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
- if ( pItem )
- {
- pItem->SetBitmap2( rBmp );
- GetModel()->InvalidateEntry( pEntry );
- }
-}
-
-void SvIconView::SetCollapsedEntryBmp(SvLBoxEntry* pEntry,
- const Image& rBmp )
-{
- SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
- if ( pItem )
- {
- pItem->SetBitmap1( rBmp );
- GetModel()->InvalidateEntry( pEntry );
- }
-}
-
-XubString SvIconView::GetEntryText(SvLBoxEntry* pEntry ) const
-{
- XubString aStr;
- SvLBoxString* pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
- if ( pItem )
- aStr = pItem->GetText();
- return aStr;
-}
-
-Image SvIconView::GetExpandedEntryBmp(SvLBoxEntry* pEntry) const
-{
- Image aBmp;
- SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
- if ( pItem )
- aBmp = pItem->GetBitmap2();
- return aBmp;
-}
-
-Image SvIconView::GetCollapsedEntryBmp(SvLBoxEntry* pEntry) const
-{
- Image aBmp;
- SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
- if ( pItem )
- aBmp = pItem->GetBitmap1();
- return aBmp;
-}
-
-
-SvLBoxEntry* SvIconView::CloneEntry( SvLBoxEntry* pSource )
-{
- XubString aStr;
- Image aCollEntryBmp;
- Image aExpEntryBmp;
-
- SvLBoxString* pStringItem = (SvLBoxString*)(pSource->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
- if ( pStringItem )
- aStr = pStringItem->GetText();
- SvLBoxContextBmp* pBmpItem =(SvLBoxContextBmp*)(pSource->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
- if ( pBmpItem )
- {
- aCollEntryBmp = pBmpItem->GetBitmap1();
- aExpEntryBmp = pBmpItem->GetBitmap2();
- }
- SvLBoxEntry* pEntry = CreateEntry( aStr, aCollEntryBmp, aExpEntryBmp );
- pEntry->SvListEntry::Clone( pSource );
- pEntry->EnableChildsOnDemand( pSource->HasChildsOnDemand() );
- pEntry->SetUserData( pSource->GetUserData() );
- return pEntry;
-}
-
-
-sal_uInt16 SvIconView::IsA()
-{
- return SV_LISTBOX_ID_ICONVIEW;
-}
-
-void SvIconView::RequestingChilds( SvLBoxEntry* pParent )
-{
- if ( !pParent->HasChilds() )
- InsertEntry( String::CreateFromAscii("<dummy>"), pParent, sal_False, LIST_APPEND );
-}
-
-void SvIconView::Paint( const Rectangle& rRect )
-{
- pImp->Paint( rRect );
-}
-
-void SvIconView::MouseButtonDown( const MouseEvent& rMEvt )
-{
- pImp->MouseButtonDown( rMEvt );
-}
-
-void SvIconView::MouseButtonUp( const MouseEvent& rMEvt )
-{
- pImp->MouseButtonUp( rMEvt );
-}
-
-void SvIconView::MouseMove( const MouseEvent& rMEvt )
-{
- pImp->MouseMove( rMEvt );
-}
-
-void SvIconView::KeyInput( const KeyEvent& rKEvt )
-{
- // unter OS/2 bekommen wir auch beim Editieren Key-Up/Down
- if( IsEditingActive() )
- return;
-
- nImpFlags |= SVLBOX_IS_TRAVELSELECT;
- sal_Bool bKeyUsed = pImp->KeyInput( rKEvt );
- if ( !bKeyUsed )
- SvLBox::KeyInput( rKEvt );
- nImpFlags &= ~SVLBOX_IS_TRAVELSELECT;
-}
-
-void SvIconView::Resize()
-{
- pImp->Resize();
- SvLBox::Resize();
-}
-
-void SvIconView::GetFocus()
-{
- pImp->GetFocus();
- SvLBox::GetFocus();
-}
-
-void SvIconView::LoseFocus()
-{
- pImp->LoseFocus();
- SvLBox::LoseFocus();
-}
-
-void SvIconView::SetUpdateMode( sal_Bool bUpdate )
-{
- Control::SetUpdateMode( bUpdate );
- if ( bUpdate )
- pImp->UpdateAll();
-}
-
-void SvIconView::SetModel( SvLBoxTreeList* )
-{
-}
-
-void SvIconView::SetModel( SvLBoxTreeList* pNewModel, SvLBoxEntry* pParent )
-{
- nIcnVwFlags |= ICNVW_BLOCK_ENTRYINS;
- SvLBox::SetModel( pNewModel );
- nIcnVwFlags &= (~ICNVW_BLOCK_ENTRYINS);
- if ( pParent && pParent->HasChildsOnDemand() )
- RequestingChilds( pParent );
- pImp->SetModel( pNewModel, pParent );
-}
-
-void SvIconView::ModelHasCleared()
-{
- SvLBox::ModelHasCleared();
- pImp->Clear();
-}
-
-void SvIconView::ModelHasInserted( SvListEntry* pEntry )
-{
- if( !(nIcnVwFlags & ICNVW_BLOCK_ENTRYINS ) )
- pImp->EntryInserted( (SvLBoxEntry*)pEntry );
-}
-
-void SvIconView::ModelHasInsertedTree( SvListEntry* pEntry )
-{
- pImp->TreeInserted( (SvLBoxEntry*)pEntry );
-}
-
-void SvIconView::ModelIsMoving(SvListEntry* pSource,
- SvListEntry* /* pTargetParent */ , sal_uLong /* nChildPos */ )
-{
- pImp->MovingEntry( (SvLBoxEntry*)pSource );
-}
-
-void SvIconView::ModelHasMoved(SvListEntry* pSource )
-{
- pImp->EntryMoved( (SvLBoxEntry*)pSource );
-}
-
-void SvIconView::ModelIsRemoving( SvListEntry* pEntry )
-{
- pImp->RemovingEntry( (SvLBoxEntry*)pEntry );
- NotifyRemoving( (SvLBoxEntry*)pEntry );
-}
-
-void SvIconView::ModelHasRemoved( SvListEntry* /* pEntry */ )
-{
- pImp->EntryRemoved();
-}
-
-void SvIconView::ModelHasEntryInvalidated( SvListEntry* pEntry )
-{
- // die einzelnen Items des Entries reinitialisieren
- SvLBox::ModelHasEntryInvalidated( pEntry );
- // painten
- pImp->ModelHasEntryInvalidated( pEntry );
-}
-
-void SvIconView::ShowTargetEmphasis( SvLBoxEntry* pEntry, sal_Bool bShow )
-{
- pImp->ShowTargetEmphasis( pEntry, bShow );
-}
-
-Point SvIconView::GetEntryPosition( SvLBoxEntry* pEntry ) const
-{
- return ((SvIconView*)this)->pImp->GetEntryPosition( pEntry );
-}
-
-void SvIconView::SetEntryPosition( SvLBoxEntry* pEntry, const Point& rPos)
-{
- pImp->SetEntryPosition( pEntry, rPos, sal_False, sal_True );
-}
-
-void SvIconView::SetEntryPosition( SvLBoxEntry* pEntry, const Point& rPos, sal_Bool bAdjustAtGrid )
-{
- pImp->SetEntryPosition( pEntry, rPos, bAdjustAtGrid );
-}
-
-void SvIconView::SetFont( const Font& rFont )
-{
- Font aTempFont( rFont );
- aTempFont.SetTransparent( sal_True );
- SvLBox::SetFont( aTempFont );
- RecalcViewData();
- pImp->ChangedFont();
-}
-
-void SvIconView::ViewDataInitialized( SvLBoxEntry* pEntry )
-{
- pImp->ViewDataInitialized( pEntry );
-}
-
-SvLBoxEntry* SvIconView::GetDropTarget( const Point& rPos )
-{
- return pImp->GetDropTarget( rPos );
-}
-
-SvLBoxEntry* SvIconView::GetEntry( const Point& rPixPos, sal_Bool ) const
-{
- Point aPos( rPixPos );
- aPos -= GetMapMode().GetOrigin();
- return ((SvIconView*)this)->pImp->GetEntry( aPos );
-}
-
-SvLBoxEntry* SvIconView::GetEntryFromLogicPos( const Point& rDocPos ) const
-{
- return ((SvIconView*)this)->pImp->GetEntry( rDocPos );
-}
-
-
-void SvIconView::StateChanged( StateChangedType i_nStateChange )
-{
- SvLBox::StateChanged( i_nStateChange );
- if ( i_nStateChange == STATE_CHANGE_STYLE )
- pImp->SetStyle( GetStyle() );
-}
-
-void SvIconView::PaintEntry( SvLBoxEntry* pEntry )
-{
- pImp->PaintEntry( pEntry );
-}
-
-
-void SvIconView::PaintEntry( SvLBoxEntry* pEntry, const Point& rPos )
-{
- pImp->PaintEntry( pEntry, rPos );
-}
-
-Rectangle SvIconView::GetFocusRect( SvLBoxEntry* pEntry )
-{
- return pImp->CalcFocusRect( pEntry );
-}
-
-void SvIconView::InvalidateEntry( SvLBoxEntry* pEntry )
-{
- pImp->InvalidateEntry( pEntry );
-}
-
-void SvIconView::SetDragDropMode( DragDropMode nDDMode )
-{
- SvLBox::SetDragDropMode( nDDMode );
- pImp->SetDragDropMode( nDDMode );
-}
-
-void SvIconView::SetSelectionMode( SelectionMode eSelectMode )
-{
- SvLBox::SetSelectionMode( eSelectMode );
- pImp->SetSelectionMode( eSelectMode );
-}
-
-sal_Bool SvIconView::Select( SvLBoxEntry* pEntry, sal_Bool bSelect )
-{
- EndEditing();
- sal_Bool bRetVal = SvListView::Select( pEntry, bSelect );
- if( bRetVal )
- {
- pImp->EntrySelected( pEntry, bSelect );
- pHdlEntry = pEntry;
- SelectHdl();
- }
- return bRetVal;
-}
-
-void SvIconView::SelectAll( sal_Bool bSelect, sal_Bool )
-{
- SvLBoxEntry* pEntry = pImp->GetCurParent();
- pEntry = FirstChild( pEntry );
- while( pEntry )
- {
- Select( pEntry, bSelect );
- pEntry = NextSibling( pEntry );
- }
-}
-
-void SvIconView::SetCurEntry( SvLBoxEntry* _pEntry )
-{
- pImp->SetCursor( _pEntry );
- OnCurrentEntryChanged();
-}
-
-SvLBoxEntry* SvIconView::GetCurEntry() const
-{
- return pImp->GetCurEntry();
-}
-
-void SvIconView::Arrange()
-{
-#ifdef DBG_UTIL
- sal_uInt16 n=1;
- if( n == 1 && n-1 == 0 )
- {
- pImp->Arrange();
- }
- else
- {
- pImp->AdjustAtGrid();
- }
-#else
- pImp->Arrange();
-#endif
-}
-
-
-void SvIconView::SetSpaceBetweenEntries( long nX, long nY )
-{
- pImp->SetSpaceBetweenEntries( nX, nY );
-}
-
-sal_Bool SvIconView::NotifyMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry,
- SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos )
-{
- return pImp->NotifyMoving(pTarget,pEntry,rpNewParent,rNewChildPos);
-}
-
-sal_Bool SvIconView::NotifyCopying( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry,
- SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos )
-{
- return pImp->NotifyCopying(pTarget,pEntry,rpNewParent,rNewChildPos);
-}
-
-
-void SvIconView::EnableInplaceEditing( sal_Bool bEnable )
-{
- SvLBox::EnableInplaceEditing( bEnable );
-}
-
-void SvIconView::EditingRequest( SvLBoxEntry* pEntry, SvLBoxItem* pItem,
- const Point& )
-{
- if ( pItem->IsA() == SV_ITEM_ID_LBOXSTRING )
- {
- Selection aSel( SELECTION_MIN, SELECTION_MAX );
- if ( EditingEntry( pEntry, aSel ) )
- {
- SelectAll( sal_False );
- EditItemText( pEntry, (SvLBoxString*)pItem, aSel );
- }
- }
-}
-
-
-void SvIconView::EditItemText( SvLBoxEntry* pEntry, SvLBoxItem* pItem,
- const Selection& rSel )
-{
- DBG_ASSERT(pEntry&&pItem,"EditItemText:Params?");
- pCurEdEntry = pEntry;
- pCurEdItem = pItem;
- Rectangle aRect( pImp->CalcTextRect( pEntry, (SvLBoxString*)pItem,0,sal_True ));
-
- aRect.Bottom() += 4;
- pImp->MakeVisible( aRect ); // vor der Umrechnung in Pixel-Koord. rufen!
- aRect.Bottom() -= 4;
-
- Point aPos( aRect.TopLeft() );
- aPos += GetMapMode().GetOrigin(); // Dok-Koord. -> Window-Koord.
- aRect.SetPos( aPos );
-
- aRect.Bottom() += 2; // sieht huebscher aus
-
- EditText( ((SvLBoxString*)pItem)->GetText(), aRect, rSel, sal_True );
-}
-
-void SvIconView::EditEntry( SvLBoxEntry* pEntry )
-{
- if( !pEntry )
- pEntry = pImp->GetCurEntry();
- if( pEntry )
- {
- SvLBoxString* pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
- if( pItem )
- {
- Selection aSel( SELECTION_MIN, SELECTION_MAX );
- if( EditingEntry( pEntry, aSel ) )
- {
- SelectAll( sal_False );
- EditItemText( pEntry, pItem, aSel );
- }
- }
- }
-}
-
-void SvIconView::EditedText( const XubString& rStr )
-{
- XubString aRefStr( ((SvLBoxString*)pCurEdItem)->GetText() );
- if ( EditedEntry( pCurEdEntry, rStr ) )
- {
- ((SvLBoxString*)pCurEdItem)->SetText( pCurEdEntry, rStr );
- pModel->InvalidateEntry( pCurEdEntry );
- }
- if( GetSelectionMode()==SINGLE_SELECTION && !GetSelectionCount())
- Select( pCurEdEntry );
-}
-
-
-sal_Bool SvIconView::EditingEntry( SvLBoxEntry*, Selection& )
-{
- return sal_True;
-}
-
-sal_Bool SvIconView::EditedEntry( SvLBoxEntry*, const XubString& )
-{
- return sal_True;
-}
-
-
-void SvIconView::WriteDragServerInfo( const Point& rPos, SvLBoxDDInfo* pInfo)
-{
- pImp->WriteDragServerInfo( rPos, pInfo );
-}
-
-void SvIconView::ReadDragServerInfo( const Point& rPos, SvLBoxDDInfo* pInfo )
-{
- pImp->ReadDragServerInfo( rPos, pInfo );
-}
-
-void SvIconView::Command( const CommandEvent& rCEvt )
-{
- pImp->PrepareCommandEvent( rCEvt.GetMousePosPixel() );
-}
-
-void SvIconView::SetCurParent( SvLBoxEntry* pNewParent )
-{
- if ( pNewParent && pNewParent->HasChildsOnDemand() )
- RequestingChilds( pNewParent );
- pImp->SetCurParent( pNewParent );
-}
-
-SvLBoxEntry* SvIconView::GetCurParent() const
-{
- return pImp->GetCurParent();
-}
-
-SvViewData* SvIconView::CreateViewData( SvListEntry* )
-{
- SvIcnVwDataEntry* pEntryData = new SvIcnVwDataEntry;
- return (SvViewData*)pEntryData;
-}
-
-void SvIconView::InitViewData( SvViewData* pData, SvListEntry* pEntry )
-{
- SvLBox::InitViewData( pData, pEntry );
- pImp->InvalidateBoundingRect( ((SvIcnVwDataEntry*)pData)->aRect );
-}
-
-Region SvIconView::GetDragRegion() const
-{
- Rectangle aRect;
- SvLBoxEntry* pEntry = GetCurEntry();
- if( pEntry )
- aRect = pImp->GetBoundingRect( pEntry );
- Region aRegion( aRect );
- return aRegion;
-}
-
-sal_uLong SvIconView::GetSelectionCount() const
-{
- return (sal_uLong)(pImp->GetSelectionCount());
-}
-
-void SvIconView::SetGrid( long nDX, long nDY )
-{
- pImp->SetGrid( nDX, nDY );
-}
-
-void SvIconView::ModelNotification( sal_uInt16 nActionId, SvListEntry* pEntry1,
- SvListEntry* pEntry2, sal_uLong nPos )
-{
- SvLBox::ModelNotification( nActionId, pEntry1, pEntry2, nPos );
- switch( nActionId )
- {
- case LISTACTION_RESORTING:
- SetUpdateMode( sal_False );
- break;
-
- case LISTACTION_RESORTED:
- SetUpdateMode( sal_True );
- Arrange();
- break;
-
- case LISTACTION_CLEARED:
- if( IsUpdateMode() )
- Update();
- break;
- }
-}
-
-
-void SvIconView::Scroll( long nDeltaX, long nDeltaY, sal_uInt16 )
-{
- pImp->Scroll( nDeltaX, nDeltaY, sal_False );
-}
-
-void SvIconView::PrepareCommandEvent( const CommandEvent& rCEvt )
-{
- pImp->PrepareCommandEvent( rCEvt.GetMousePosPixel() );
-}
-
-void SvIconView::StartDrag( sal_Int8 nAction, const Point& rPos )
-{
- pImp->SttDrag( rPos );
- SvLBoxEntry* pEntry = GetEntry( rPos, sal_True );
- pImp->mpViewData = pEntry;
- SvLBox::StartDrag( nAction, rPos );
-}
-
-void SvIconView::DragFinished( sal_Int8 )
-{
- pImp->EndDrag();
-}
-
-sal_Int8 SvIconView::AcceptDrop( const AcceptDropEvent& rEvt )
-{
- if( pImp->mpViewData )
- pImp->HideDDIcon();
- sal_Int8 nRet = SvLBox::AcceptDrop( rEvt );
- if( DND_ACTION_NONE != nRet )
- pImp->ShowDDIcon( pImp->mpViewData, rEvt.maPosPixel );
-
- return nRet;
-}
-
-sal_Int8 SvIconView::ExecuteDrop( const ExecuteDropEvent& rEvt )
-{
- if( pImp->mpViewData )
- {
- pImp->HideDDIcon();
- pImp->mpViewData = 0;
- }
- return SvLBox::ExecuteDrop( rEvt );
-}
-
-void SvIconView::ShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPos )
-{
- pImp->ShowDDIcon( pRefEntry, rPos );
-}
-
-void SvIconView::HideDDIcon()
-{
- pImp->HideDDIcon();
-}
-
-void SvIconView::HideShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPos )
-{
- pImp->HideShowDDIcon( pRefEntry, rPos );
-}
-
-void SvIconView::SelectRect( const Rectangle& rRect, sal_Bool bAdd,
- SvPtrarr* pRects, short nOffs )
-{
- pImp->SelectRect( rRect, bAdd, pRects, nOffs );
-}
-
-void SvIconView::CalcScrollOffsets( const Point& rRefPosPixel, long& rX, long& rY,
- sal_Bool b, sal_uInt16 nBorderWidth )
-{
- pImp->CalcScrollOffsets( rRefPosPixel, rX, rY, b, nBorderWidth );
-}
-
-void SvIconView::EndTracking()
-{
- pImp->EndTracking();
-}
-
-void SvIconView::MakeVisible( SvLBoxEntry* pEntry )
-{
- pImp->MakeVisible( pEntry );
-}
-
-void SvIconView::PreparePaint( SvLBoxEntry* )
-{
-}
-
-void SvIconView::AdjustAtGrid( SvLBoxEntry* pEntry )
-{
- pImp->AdjustAtGrid( pEntry );
-}
-
-void SvIconView::LockEntryPos( SvLBoxEntry* pEntry, sal_Bool bLock )
-{
- SvIcnVwDataEntry* pViewData = (SvIcnVwDataEntry*)GetViewData( pEntry );
- if( bLock )
- pViewData->SetVwFlags( ICNVW_FLAG_POS_LOCKED );
- else
- pViewData->ClearVwFlags( ICNVW_FLAG_POS_LOCKED );
-}
-
-sal_Bool SvIconView::IsEntryPosLocked( const SvLBoxEntry* pEntry ) const
-{
- const SvIcnVwDataEntry* pViewData = (const SvIcnVwDataEntry*)GetViewData( (SvListEntry*)pEntry );
- return pViewData->IsEntryPosLocked();
-}
-
-void SvIconView::SetTextMode( SvIconViewTextMode eMode, SvLBoxEntry* pEntry )
-{
- pImp->SetTextMode( eMode, pEntry );
-}
-
-SvIconViewTextMode SvIconView::GetTextMode( const SvLBoxEntry* pEntry ) const
-{
- return pImp->GetTextMode( pEntry );
-}
-
-SvLBoxEntry* SvIconView::GetNextEntry( const Point& rPixPos, SvLBoxEntry* pCurEntry, sal_Bool ) const
-{
- Point aPos( rPixPos );
- aPos -= GetMapMode().GetOrigin();
- return ((SvIconView*)this)->pImp->GetNextEntry( aPos, pCurEntry );
-}
-
-SvLBoxEntry* SvIconView::GetPrevEntry( const Point& rPixPos, SvLBoxEntry* pCurEntry, sal_Bool ) const
-{
- Point aPos( rPixPos );
- aPos -= GetMapMode().GetOrigin();
- return ((SvIconView*)this)->pImp->GetPrevEntry( aPos, pCurEntry );
-}
-
-void SvIconView::ShowFocusRect( const SvLBoxEntry* pEntry )
-{
- pImp->ShowFocusRect( pEntry );
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx
index da5aff817b60..e0e9efca6f59 100644
--- a/svtools/source/contnr/svimpbox.cxx
+++ b/svtools/source/contnr/svimpbox.cxx
@@ -1012,6 +1012,34 @@ void SvImpLBox::MakeVisible( SvLBoxEntry* pEntry, sal_Bool bMoveToTop )
pView->Invalidate();
}
+void SvImpLBox::ScrollToAbsPos( long nPos )
+{
+ if( pView->GetVisibleCount() == 0 )
+ return;
+ long nLastEntryPos = pView->GetAbsPos( pView->Last() );
+
+ if( nPos < 0 )
+ nPos = 0;
+ else if( nPos > nLastEntryPos )
+ nPos = nLastEntryPos;
+
+ SvLBoxEntry* pEntry = (SvLBoxEntry*)pView->GetEntryAtAbsPos( nPos );
+ if( !pEntry || pEntry == pStartEntry )
+ return;
+
+ if( pStartEntry || (m_nStyle & WB_FORCE_MAKEVISIBLE) )
+ nFlags &= (~F_FILLING);
+
+ if( pView->IsEntryVisible(pEntry) )
+ {
+ pStartEntry = pEntry;
+ ShowCursor( sal_False );
+ aVerSBar.SetThumbPos( nPos );
+ ShowCursor( sal_True );
+ if (GetUpdateMode())
+ pView->Invalidate();
+ }
+}
void SvImpLBox::RepaintSelectionItems()
{
@@ -1358,8 +1386,19 @@ void SvImpLBox::InitScrollBarBox()
void SvImpLBox::Resize()
{
Size aSize( pView->Control::GetOutputSizePixel());
+ long nEntryHeight = pView->GetEntryHeight();
+ int nEntryCount = 0;
+
if( aSize.Width() <= 0 || aSize.Height() <= 0 )
return;
+ if( nEntryHeight )
+ {
+ // Set the view height to an integer multiple of the entry height.
+ nEntryCount = (int) aSize.Height() / nEntryHeight;
+ aSize.Height() = pView->GetEntryHeight() * nEntryCount;
+ pView->Control::SetOutputSizePixel( aSize );
+ }
+
nFlags |= F_IN_RESIZE;
InitScrollBarBox();
diff --git a/svtools/source/contnr/svimpicn.cxx b/svtools/source/contnr/svimpicn.cxx
deleted file mode 100644
index 3514c7b6a271..000000000000
--- a/svtools/source/contnr/svimpicn.cxx
+++ /dev/null
@@ -1,4093 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-
-#include <limits.h>
-#include <vcl/metric.hxx>
-#include <vcl/svapp.hxx>
-#ifdef DBG_UTIL
-#include <vcl/sound.hxx>
-#endif
-
-#include <svtools/svlbox.hxx>
-#include <svtools/svicnvw.hxx>
-#include <svimpicn.hxx>
-#include <svtools/svlbitm.hxx>
-#include <svl/svarray.hxx>
-
-
-
-#define VIEWMODE_ICON 0x0001 // Text unter Bitmap
-#define VIEWMODE_NAME 0x0002 // Text rechts neben Bitmap
-#define VIEWMODE_TEXT 0x0004 // Text ohne Bitmap
-
-#define DD_SCROLL_PIXEL 10
-
-// alle Angaben in Pixel
-
-#define ICONVIEW_OFFS_BMP_STRING 3
-
-// fuer das Bounding-Rectangle
-#define LROFFS_BOUND 2
-#define TBOFFS_BOUND 2
-
-// fuer das Focus-Rectangle um Icons
-#define LROFFS_ICON 2
-#define TBOFFS_ICON 2
-
-#define NAMEVIEW_OFFS_BMP_STRING 3
-
-// Abstaende von Fensterraendern
-#define LROFFS_WINBORDER 4
-#define TBOFFS_WINBORDER 4
-
-// Breitenoffset Highlight-Rect bei Text
-#define LROFFS_TEXT 2
-
-
-#define ICNVIEWDATA(xPtr) (SvIcnVwDataEntry*)(pView->GetViewDataEntry(xPtr))
-#define ICNVIEWDATA2(xPtr) (SvIcnVwDataEntry*)(pView->pView->GetViewDataEntry(xPtr))
-
-//--------------------------------------------------------------------------
-//--------------------------------------------------------------------------
-//--------------------------------------------------------------------------
-// -------------------------------------------------------------------------
-// Hilfsfunktionen von Thomas Hosemann zur mehrzeiligen Ausgabe von
-// Strings. Die Funktionen werden spaeter in StarView integriert.
-// -------------------------------------------------------------------------
-//--------------------------------------------------------------------------
-//--------------------------------------------------------------------------
-//--------------------------------------------------------------------------
-
-// keine doppelten Defines
-#ifdef TEXT_DRAW_CLIP
-#undef TEXT_DRAW_CLIP
-#endif
-#ifdef TEXT_DRAW_MULTILINE
-#undef TEXT_DRAW_MULTILINE
-#endif
-#ifdef TEXT_DRAW_WORDBREAK
-#undef TEXT_DRAW_WORDBREAK
-#endif
-
-// #define TEXT_DRAW_DISABLE ((sal_uInt16)0x0001)
-// #define TEXT_DRAW_3DLOOK ((sal_uInt16)0x0002)
-// #define TEXT_DRAW_MNEMONIC ((sal_uInt16)0x0004)
-#define TEXT_DRAW_LEFT ((sal_uInt16)0x0010)
-#define TEXT_DRAW_CENTER ((sal_uInt16)0x0020)
-#define TEXT_DRAW_RIGHT ((sal_uInt16)0x0040)
-#define TEXT_DRAW_TOP ((sal_uInt16)0x0080)
-#define TEXT_DRAW_VCENTER ((sal_uInt16)0x0100)
-#define TEXT_DRAW_BOTTOM ((sal_uInt16)0x0200)
-#define TEXT_DRAW_ENDELLIPSIS ((sal_uInt16)0x0400)
-#define TEXT_DRAW_PATHELLIPSIS ((sal_uInt16)0x0800)
-#define TEXT_DRAW_CLIP ((sal_uInt16)0x1000)
-#define TEXT_DRAW_MULTILINE ((sal_uInt16)0x2000)
-#define TEXT_DRAW_WORDBREAK ((sal_uInt16)0x4000)
-
-XubString GetEllipsisString( OutputDevice* pDev,
- const XubString& rStr, long nMaxWidth,
- sal_uInt16 nStyle = TEXT_DRAW_ENDELLIPSIS )
-{
- XubString aStr = rStr;
-
- if ( nStyle & TEXT_DRAW_ENDELLIPSIS )
- {
- sal_uInt16 nIndex = pDev->GetTextBreak( rStr, nMaxWidth );
- if ( nIndex != STRING_LEN )
- {
- aStr.Erase( nIndex );
- if ( nIndex > 1 )
- {
- aStr.AppendAscii("...");
- while ( aStr.Len() &&
- (pDev->GetTextWidth( aStr ) > nMaxWidth) )
- {
- if ( (nIndex > 1) || (nIndex == aStr.Len()) )
- nIndex--;
- aStr.Erase( nIndex, 1 );
- }
- }
-
- if ( !aStr.Len() && (nStyle & TEXT_DRAW_CLIP) )
- aStr += rStr.GetChar( 0 );
- }
- }
-
- return aStr;
-}
-
-class TextLineInfo
-{
-private:
- long mnWidth;
- sal_uInt16 mnIndex;
- sal_uInt16 mnLen;
-
-public:
- TextLineInfo( long nWidth, sal_uInt16 nIndex, sal_uInt16 nLen )
- {
- mnWidth = nWidth;
- mnIndex = nIndex;
- mnLen = nLen;
- }
-
- long GetWidth() const { return mnWidth; }
- sal_uInt16 GetIndex() const { return mnIndex; }
- sal_uInt16 GetLen() const { return mnLen; }
-};
-
-#define MULTITEXTLINEINFO_RESIZE 16
-typedef TextLineInfo* PTextLineInfo;
-
-class MultiTextLineInfo
-{
-private:
- PTextLineInfo* mpLines;
- sal_uInt16 mnLines;
- sal_uInt16 mnSize;
-
-public:
- MultiTextLineInfo();
- ~MultiTextLineInfo();
-
- void AddLine( TextLineInfo* pLine );
- void Clear();
-
- TextLineInfo* GetLine( sal_uInt16 nLine ) const
- { return mpLines[nLine]; }
- sal_uInt16 Count() const { return mnLines; }
-
-private:
- MultiTextLineInfo( const MultiTextLineInfo& );
- MultiTextLineInfo& operator=( const MultiTextLineInfo& );
-};
-
-MultiTextLineInfo::MultiTextLineInfo()
-{
- mpLines = new PTextLineInfo[MULTITEXTLINEINFO_RESIZE];
- mnLines = 0;
- mnSize = MULTITEXTLINEINFO_RESIZE;
-}
-
-MultiTextLineInfo::~MultiTextLineInfo()
-{
- for ( sal_uInt16 i = 0; i < mnLines; i++ )
- delete mpLines[i];
- delete [] mpLines;
-}
-
-void MultiTextLineInfo::AddLine( TextLineInfo* pLine )
-{
- if ( mnSize == mnLines )
- {
- mnSize += MULTITEXTLINEINFO_RESIZE;
- PTextLineInfo* pNewLines = new PTextLineInfo[mnSize];
- memcpy( pNewLines, mpLines, mnLines*sizeof(PTextLineInfo) );
- mpLines = pNewLines;
- }
-
- mpLines[mnLines] = pLine;
- mnLines++;
-}
-
-void MultiTextLineInfo::Clear()
-{
- for ( sal_uInt16 i = 0; i < mnLines; i++ )
- delete mpLines[i];
- mnLines = 0;
-}
-
-// -----------------------------------------------------------------------
-
-long GetTextLines( OutputDevice* pDev, MultiTextLineInfo& rLineInfo,
- long nWidth, const XubString& rStr,
- sal_uInt16 nStyle = TEXT_DRAW_WORDBREAK )
-{
- rLineInfo.Clear();
- if ( !rStr.Len() )
- return 0;
- if ( nWidth <= 0 )
- nWidth = 1;
-
- sal_uInt16 nStartPos = 0; // Start-Position der Zeile
- sal_uInt16 nLastLineLen = 0; // Zeilenlaenge bis zum vorherigen Wort
- sal_uInt16 nLastWordPos = 0; // Position des letzten Wortanfangs
- sal_uInt16 i = 0;
- sal_uInt16 nPos; // StartPositon der Zeile (nur Temp)
- sal_uInt16 nLen; // Laenge der Zeile (nur Temp)
- sal_uInt16 nStrLen = rStr.Len();
- long nMaxLineWidth = 0; // Maximale Zeilenlaenge
- long nLineWidth; // Aktuelle Zeilenlaenge
- long nLastLineWidth = 0; // Zeilenlaenge der letzten Zeile
- xub_Unicode c;
- xub_Unicode c2;
- const xub_Unicode* pStr = rStr.GetBuffer();
- sal_Bool bHardBreak = sal_False;
-
- do
- {
- c = pStr[i];
-
- // Auf Zeilenende ermitteln
- if ( (c == _CR) || (c == _LF) )
- bHardBreak = sal_True;
- else
- bHardBreak = sal_False;
-
- // Testen, ob ein Wortende erreicht ist
- if ( bHardBreak || (i == nStrLen) ||
- (((c == ' ') || (c == '-')) && (nStyle & TEXT_DRAW_WORDBREAK)) )
- {
- nLen = i-nStartPos;
- if ( c == '-' )
- nLen++;
- nLineWidth = pDev->GetTextWidth( rStr, nStartPos, nLen );
-
- // Findet ein Zeilenumbruch statt
- if ( bHardBreak || (i == nStrLen) ||
- ((nLineWidth >= nWidth) && (nStyle & TEXT_DRAW_WORDBREAK)) )
- {
- nPos = nStartPos;
-
- if ( (nLineWidth >= nWidth) && (nStyle & TEXT_DRAW_WORDBREAK) )
- {
- nLineWidth = nLastLineWidth;
- nLen = nLastLineLen;
- nStartPos = nLastWordPos;
- nLastLineLen = i-nStartPos;
- nLastWordPos = nStartPos+nLastLineLen+1;
- if ( c == '-' )
- nLastLineLen++;
- else if ( bHardBreak && (i > nStartPos) )
- i--;
- }
- else
- {
- nStartPos = i;
- // Zeilenende-Zeichen und '-' beruecksichtigen
- if ( bHardBreak )
- {
- nStartPos++;
- c2 = pStr[i+1];
- if ( (c != c2) && ((c2 == _CR) || (c2 == _LF)) )
- {
- nStartPos++;
- i++;
- }
- }
- else if ( c != '-' )
- nStartPos++;
- nLastWordPos = nStartPos;
- nLastLineLen = 0;
- }
-
- if ( nLineWidth > nMaxLineWidth )
- nMaxLineWidth = nLineWidth;
-
- if ( nLen || bHardBreak )
- rLineInfo.AddLine( new TextLineInfo( nLineWidth, nPos, nLen ) );
-
- // Testen, ob aktuelles Wort noch auf die Zeile passt,
- // denn ansonsten mueessen wir es auftrennen
- if ( nLastLineLen )
- {
- nLineWidth = pDev->GetTextWidth( rStr, nStartPos, nLastLineLen );
- if ( nLineWidth > nWidth )
- {
- // Wenn ein Wortumbruch in einem Wort stattfindet,
- // ist die maximale Zeilenlaenge die Laenge
- // des laengsten Wortes
- if ( nLineWidth > nMaxLineWidth )
- nMaxLineWidth = nLineWidth;
-
- // Solange Wort auftrennen, bis es auf eine Zeile passt
- do
- {
- nPos = pDev->GetTextBreak( rStr, nWidth, nStartPos, nLastLineLen );
- nLen = nPos-nStartPos;
- if ( !nLen )
- {
- nPos++;
- nLen++;
- }
- nLineWidth = pDev->GetTextWidth( rStr, nStartPos, nLen );
- rLineInfo.AddLine( new TextLineInfo( nLineWidth, nStartPos, nLen ) );
- nStartPos = nPos;
- nLastLineLen = nLastLineLen - nLen;
- nLineWidth = pDev->GetTextWidth( rStr, nStartPos, nLastLineLen );
- }
- while ( nLineWidth > nWidth );
- }
- nLastLineWidth = nLineWidth;
-
- // Bei Stringende muessen wir die letzte Zeile auch noch
- // dranhaengen
- if ( (i == nStrLen) && nLastLineLen )
- rLineInfo.AddLine( new TextLineInfo( nLastLineWidth, nStartPos, nLastLineLen ) );
- }
- else
- nLastLineWidth = 0;
- }
- else
- {
- nLastLineWidth = nLineWidth;
- nLastLineLen = nLen;
- nLastWordPos = nStartPos+nLastLineLen;
- if ( c != '-' )
- nLastWordPos++;
- }
- }
-
- i++;
- }
- while ( i <= nStrLen );
-
- return nMaxLineWidth;
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 GetTextLines( OutputDevice* pDev, const Rectangle& rRect,
- const XubString& rStr,
- sal_uInt16 nStyle = TEXT_DRAW_WORDBREAK,
- long* pMaxWidth = NULL )
-{
- MultiTextLineInfo aMultiLineInfo;
- long nMaxWidth = GetTextLines( pDev, aMultiLineInfo,
- rRect.GetWidth(), rStr, nStyle );
- if ( pMaxWidth )
- *pMaxWidth = nMaxWidth;
- return aMultiLineInfo.Count();
-}
-
-// -----------------------------------------------------------------------
-
-Rectangle GetTextRect( OutputDevice* pDev, const Rectangle& rRect,
- const XubString& rStr,
- sal_uInt16 nStyle = TEXT_DRAW_WORDBREAK )
-{
- Rectangle aRect = rRect;
- sal_uInt16 nLines;
- long nWidth = rRect.GetWidth();
- long nMaxWidth;
- long nTextHeight;
-
- if ( nStyle & TEXT_DRAW_MULTILINE )
- {
- MultiTextLineInfo aMultiLineInfo;
- TextLineInfo* pLineInfo;
- sal_uInt16 nFormatLines;
-
- nMaxWidth = 0;
- GetTextLines( pDev, aMultiLineInfo, nWidth, rStr, nStyle );
- nFormatLines = aMultiLineInfo.Count();
- nTextHeight = pDev->GetTextHeight();
- nLines = (sal_uInt16)(aRect.GetHeight()/nTextHeight);
- if ( nFormatLines <= nLines )
- nLines = nFormatLines;
- else
- {
- if ( !(nStyle & TEXT_DRAW_ENDELLIPSIS) )
- nLines = nFormatLines;
- else
- nMaxWidth = nWidth;
- }
- for ( sal_uInt16 i = 0; i < nLines; i++ )
- {
- pLineInfo = aMultiLineInfo.GetLine( i );
- if ( pLineInfo->GetWidth() > nMaxWidth )
- nMaxWidth = pLineInfo->GetWidth();
- }
- }
- else
- {
- nLines = 1;
- nMaxWidth = pDev->GetTextWidth( rStr );
- nTextHeight = pDev->GetTextHeight();
- if ( (nMaxWidth > nWidth) && (nStyle & TEXT_DRAW_ENDELLIPSIS) )
- nMaxWidth = nWidth;
- }
-
- if ( nStyle & TEXT_DRAW_RIGHT )
- aRect.Left() = aRect.Right()-nMaxWidth+1;
- else if ( nStyle & TEXT_DRAW_CENTER )
- {
- aRect.Left() += (nWidth-nMaxWidth)/2;
- aRect.Right() = aRect.Left()+nMaxWidth-1;
- }
- else
- aRect.Right() = aRect.Left()+nMaxWidth-1;
-
- if ( nStyle & TEXT_DRAW_BOTTOM )
- aRect.Top() = aRect.Bottom()-(nTextHeight*nLines)+1;
- else if ( nStyle & TEXT_DRAW_VCENTER )
- {
- aRect.Top() += (aRect.GetHeight()-(nTextHeight*nLines))/2;
- aRect.Bottom() = aRect.Top()+(nTextHeight*nLines)-1;
- }
- else
- aRect.Bottom() = aRect.Top()+(nTextHeight*nLines)-1;
-
- return aRect;
-}
-
-// -----------------------------------------------------------------------
-
-void DrawText( OutputDevice* pDev, const Rectangle& rRect,
- const XubString& rStr, sal_uInt16 nStyle = 0 )
-{
- if ( !rStr.Len() || rRect.IsEmpty() )
- return;
-
- Point aPos = rRect.TopLeft();
- long nWidth = rRect.GetWidth();
- long nHeight = rRect.GetHeight();
- FontAlign eAlign = pDev->GetFont().GetAlign();
-
- if ( ((nWidth <= 0) || (nHeight <= 0)) && (nStyle & TEXT_DRAW_CLIP) )
- return;
-
- // Mehrzeiligen Text behandeln wir anders
- if ( nStyle & TEXT_DRAW_MULTILINE )
- {
- String aLastLine;
- Region aOldRegion;
- MultiTextLineInfo aMultiLineInfo;
- TextLineInfo* pLineInfo;
- long nTextHeight = pDev->GetTextHeight();
- long nMaxTextWidth;
- sal_uInt16 i;
- sal_uInt16 nLines = (sal_uInt16)(nHeight/nTextHeight);
- sal_uInt16 nFormatLines;
- sal_Bool bIsClipRegion = sal_False;
- nMaxTextWidth = GetTextLines( pDev, aMultiLineInfo, nWidth, rStr, nStyle );
-
- nFormatLines = aMultiLineInfo.Count();
- if ( nFormatLines > nLines )
- {
- if ( nStyle & TEXT_DRAW_ENDELLIPSIS )
- {
- // Letzte Zeile zusammenbauen und kuerzen
- nFormatLines = nLines-1;
- pLineInfo = aMultiLineInfo.GetLine( nFormatLines );
- aLastLine = rStr.Copy( pLineInfo->GetIndex() );
- aLastLine.ConvertLineEnd( LINEEND_LF );
- aLastLine.SearchAndReplace( _LF, ' ' );
- aLastLine = GetEllipsisString( pDev, aLastLine, nWidth, nStyle );
- nStyle &= ~(TEXT_DRAW_VCENTER | TEXT_DRAW_BOTTOM);
- nStyle |= TEXT_DRAW_TOP;
- }
- }
- else
- {
- if ( nMaxTextWidth <= nWidth )
- nStyle &= ~TEXT_DRAW_CLIP;
- }
-
- // Clipping setzen
- if ( nStyle & TEXT_DRAW_CLIP )
- {
- bIsClipRegion = pDev->IsClipRegion();
- if ( bIsClipRegion )
- {
- aOldRegion = pDev->GetClipRegion();
- pDev->IntersectClipRegion( rRect );
- }
- else
- {
- Region aRegion( rRect );
- pDev->SetClipRegion( aRegion );
- }
- }
-
- // Vertikales Alignment
- if ( nStyle & TEXT_DRAW_BOTTOM )
- aPos.Y() += nHeight-(nFormatLines*nTextHeight);
- else if ( nStyle & TEXT_DRAW_VCENTER )
- aPos.Y() += (nHeight-(nFormatLines*nTextHeight))/2;
-
- // Font Alignment
- if ( eAlign == ALIGN_BOTTOM )
- aPos.Y() += nTextHeight;
- else if ( eAlign == ALIGN_BASELINE )
- aPos.Y() += pDev->GetFontMetric().GetAscent();
-
- // Alle Zeilen ausgeben, bis auf die letzte
- for ( i = 0; i < nFormatLines; i++ )
- {
- pLineInfo = aMultiLineInfo.GetLine( i );
- if ( nStyle & TEXT_DRAW_RIGHT )
- aPos.X() += nWidth-pLineInfo->GetWidth();
- else if ( nStyle & TEXT_DRAW_CENTER )
- aPos.X() += (nWidth-pLineInfo->GetWidth())/2;
- pDev->DrawText( aPos, rStr, pLineInfo->GetIndex(), pLineInfo->GetLen() );
- aPos.Y() += nTextHeight;
- aPos.X() = rRect.Left();
- }
-
- // Gibt es noch eine letzte Zeile, dann diese linksbuendig ausgeben,
- // da die Zeile gekuerzt wurde
- if ( aLastLine.Len() )
- pDev->DrawText( aPos, aLastLine );
-
- // Clipping zuruecksetzen
- if ( nStyle & TEXT_DRAW_CLIP )
- {
- if ( bIsClipRegion )
- pDev->SetClipRegion( aOldRegion );
- else
- pDev->SetClipRegion();
- }
- }
- else
- {
- XubString aStr = rStr;
- Size aTextSize(pDev->GetTextWidth( aStr ), pDev->GetTextHeight());
-
- // Evt. Text kuerzen
- if ( aTextSize.Width() > nWidth )
- {
- if ( nStyle & TEXT_DRAW_ENDELLIPSIS )
- {
- aStr = GetEllipsisString( pDev, rStr, nWidth, nStyle );
- nStyle &= ~(TEXT_DRAW_CENTER | TEXT_DRAW_RIGHT);
- nStyle |= TEXT_DRAW_LEFT;
- aTextSize.Width() = pDev->GetTextWidth(aStr);
- }
- }
- else
- {
- if ( aTextSize.Height() <= nHeight )
- nStyle &= ~TEXT_DRAW_CLIP;
- }
-
- // Vertikales Alignment
- if ( nStyle & TEXT_DRAW_RIGHT )
- aPos.X() += nWidth-aTextSize.Width();
- else if ( nStyle & TEXT_DRAW_CENTER )
- aPos.X() += (nWidth-aTextSize.Width())/2;
-
- // Font Alignment
- if ( eAlign == ALIGN_BOTTOM )
- aPos.Y() += aTextSize.Height();
- else if ( eAlign == ALIGN_BASELINE )
- aPos.Y() += pDev->GetFontMetric().GetAscent();
-
- if ( nStyle & TEXT_DRAW_BOTTOM )
- aPos.Y() += nHeight-aTextSize.Height();
- else if ( nStyle & TEXT_DRAW_VCENTER )
- aPos.Y() += (nHeight-aTextSize.Height())/2;
-
- if ( nStyle & TEXT_DRAW_CLIP )
- {
- sal_Bool bIsClipRegion = pDev->IsClipRegion();
- if ( bIsClipRegion )
- {
- Region aOldRegion = pDev->GetClipRegion();
- pDev->IntersectClipRegion( rRect );
- pDev->DrawText( aPos, aStr );
- pDev->SetClipRegion( aOldRegion );
- }
- else
- {
- Region aRegion( rRect );
- pDev->SetClipRegion( aRegion );
- pDev->DrawText( aPos, aStr );
- pDev->SetClipRegion();
- }
- }
- else
- pDev->DrawText( aPos, aStr );
- }
-}
-
-// -----------------------------------------------------------------------
-
-
-//--------------------------------------------------------------------------
-//--------------------------------------------------------------------------
-//--------------------------------------------------------------------------
-
-
-#define DRAWTEXT_FLAGS (TEXT_DRAW_CENTER|TEXT_DRAW_TOP|TEXT_DRAW_ENDELLIPSIS|\
- TEXT_DRAW_CLIP|TEXT_DRAW_MULTILINE|TEXT_DRAW_WORDBREAK)
-
-
-class ImpIcnCursor
-{
- SvImpIconView* pView;
- SvPtrarr* pColumns;
- SvPtrarr* pRows;
- sal_Bool* pGridMap;
- long nGridDX, nGridDY;
- long nGridCols, nGridRows;
- long nCols;
- long nRows;
- short nDeltaWidth;
- short nDeltaHeight;
- SvLBoxEntry* pCurEntry;
- void SetDeltas();
- void ImplCreate();
- void Create() { if( !pColumns ) ImplCreate(); }
-
- sal_uInt16 GetSortListPos( SvPtrarr* pList, long nValue, int bVertical);
- SvLBoxEntry* SearchCol(sal_uInt16 nCol,sal_uInt16 nTop,sal_uInt16 nBottom,sal_uInt16 nPref,
- sal_Bool bDown, sal_Bool bSimple );
- SvLBoxEntry* SearchRow(sal_uInt16 nRow,sal_uInt16 nRight,sal_uInt16 nLeft,sal_uInt16 nPref,
- sal_Bool bRight, sal_Bool bSimple );
-
- void CreateGridMap();
- // Rueckgabe sal_False: Eintrag liegt nicht in der GridMap. rGridx,y werden
- // dann an nGridCols, nGridRows geclippt
- sal_Bool GetGrid( const Point& rDocPos, sal_uInt16& rGridX, sal_uInt16& rGridY ) const;
- void SetGridUsed( sal_uInt16 nDX, sal_uInt16 nDY, sal_Bool bUsed )
- {
- pGridMap[ (nDY * nGridCols) + nDX ] = bUsed;
- }
-public:
- ImpIcnCursor( SvImpIconView* pOwner );
- ~ImpIcnCursor();
- void Clear( sal_Bool bGridToo = sal_True );
-
- // fuer Cursortravelling usw.
- SvLBoxEntry* GoLeftRight( SvLBoxEntry*, sal_Bool bRight );
- SvLBoxEntry* GoUpDown( SvLBoxEntry*, sal_Bool bDown );
-
- // Rueckgaebe: sal_False == Das leere Rect steht hinter dem letzten
- // Eintrag; d.h. beim naechsten Einfuegen ergibt sich das naechste
- // leere Rechteck durch Addition. Hinweis: Das Rechteck kann dann
- // ausserhalb des View-Space liegen
- sal_Bool FindEmptyGridRect( Rectangle& rRect );
-
- // Erzeugt fuer jede Zeile (Hoehe=nGridDY) eine nach BoundRect.Left()
- // sortierte Liste der Eintraege, die in ihr stehen. Eine Liste kann
- // leer sein. Die Listen gehen in das Eigentum des Rufenden ueber und
- // muessen mit DestroyGridAdjustData geloescht werden
- void CreateGridAjustData( SvPtrarr& pLists, SvLBoxEntry* pRow=0);
- static void DestroyGridAdjustData( SvPtrarr& rLists );
- void SetGridUsed( const Rectangle&, sal_Bool bUsed = sal_True );
-};
-
-
-
-
-SvImpIconView::SvImpIconView( SvIconView* pCurView, SvLBoxTreeList* pTree,
- WinBits i_nWinStyle ) :
- aVerSBar( pCurView, WB_DRAG | WB_VSCROLL ),
- aHorSBar( pCurView, WB_DRAG | WB_HSCROLL )
-{
- pView = pCurView;
- pModel = pTree;
- pCurParent = 0;
- pZOrderList = new SvPtrarr;
- SetStyle( i_nWinStyle );
- nHorDist = 0;
- nVerDist = 0;
- nFlags = 0;
- nCurUserEvent = 0;
- nMaxVirtWidth = 200;
- pDDRefEntry = 0;
- pDDDev = 0;
- pDDBufDev = 0;
- pDDTempDev = 0;
- eTextMode = ShowTextShort;
- pImpCursor = new ImpIcnCursor( this );
-
- aVerSBar.SetScrollHdl( LINK( this, SvImpIconView, ScrollUpDownHdl ) );
- aHorSBar.SetScrollHdl( LINK( this, SvImpIconView, ScrollLeftRightHdl ) );
- nHorSBarHeight = aHorSBar.GetSizePixel().Height();
- nVerSBarWidth = aVerSBar.GetSizePixel().Width();
-
- aMouseMoveTimer.SetTimeout( 20 );
- aMouseMoveTimer.SetTimeoutHdl(LINK(this,SvImpIconView,MouseMoveTimeoutHdl));
-
- aEditTimer.SetTimeout( 800 );
- aEditTimer.SetTimeoutHdl(LINK(this,SvImpIconView,EditTimeoutHdl));
-
- Clear( sal_True );
-}
-
-SvImpIconView::~SvImpIconView()
-{
- StopEditTimer();
- CancelUserEvent();
- delete pZOrderList;
- delete pImpCursor;
- delete pDDDev;
- delete pDDBufDev;
- delete pDDTempDev;
- ClearSelectedRectList();
-}
-
-void SvImpIconView::Clear( sal_Bool bInCtor )
-{
- StopEditTimer();
- CancelUserEvent();
- nMaxBmpWidth = 0;
- nMaxBmpHeight = 0;
- nMaxTextWidth = 0;
- bMustRecalcBoundingRects = sal_False;
- nMaxBoundHeight = 0;
-
- //XXX
- nFlags |= F_GRID_INSERT;
- nFlags &= ~F_PAINTED;
- SetNextEntryPos( Point( LROFFS_WINBORDER, TBOFFS_WINBORDER ) );
- pCursor = 0;
- if( !bInCtor )
- {
- pImpCursor->Clear();
- aVirtOutputSize.Width() = 0;
- aVirtOutputSize.Height() = 0;
- pZOrderList->Remove(0,pZOrderList->Count());
- MapMode aMapMode( pView->GetMapMode());
- aMapMode.SetOrigin( Point() );
- pView->SetMapMode( aMapMode );
- if( pView->IsUpdateMode() )
- pView->Invalidate();
- }
- AdjustScrollBars();
-}
-
-void SvImpIconView::SetStyle( const WinBits i_nWinStyle )
-{
- nViewMode = VIEWMODE_TEXT;
- if( i_nWinStyle & WB_NAME )
- nViewMode = VIEWMODE_NAME;
- if( i_nWinStyle & WB_ICON )
- nViewMode = VIEWMODE_ICON;
-}
-
-
-IMPL_LINK( SvImpIconView, ScrollUpDownHdl, ScrollBar *, pScrollBar )
-{
- pView->EndEditing( sal_True );
- // Pfeil hoch: delta=-1; Pfeil runter: delta=+1
- Scroll( 0, pScrollBar->GetDelta(), sal_True );
- return 0;
-}
-
-IMPL_LINK( SvImpIconView, ScrollLeftRightHdl, ScrollBar *, pScrollBar )
-{
- pView->EndEditing( sal_True );
- // Pfeil links: delta=-1; Pfeil rechts: delta=+1
- Scroll( pScrollBar->GetDelta(), 0, sal_True );
- return 0;
-}
-
-void SvImpIconView::ChangedFont()
-{
- StopEditTimer();
- ImpArrange();
-}
-
-
-void SvImpIconView::CheckAllSizes()
-{
- nMaxTextWidth = 0;
- nMaxBmpWidth = 0;
- nMaxBmpHeight = 0;
- SvLBoxEntry* pEntry = pModel->First();
- while( pEntry )
- {
- CheckSizes( pEntry );
- pEntry = pModel->Next( pEntry );
- }
-}
-
-void SvImpIconView::CheckSizes( SvLBoxEntry* pEntry,
- const SvIcnVwDataEntry* pViewData )
-{
- Size aSize;
-
- if( !pViewData )
- pViewData = ICNVIEWDATA(pEntry);
-
- SvLBoxString* pStringItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
- if( pStringItem )
- {
- aSize = GetItemSize( pView, pEntry, pStringItem, pViewData );
- if( aSize.Width() > nMaxTextWidth )
- {
- nMaxTextWidth = aSize.Width();
- if( !(nFlags & F_GRIDMODE ) )
- bMustRecalcBoundingRects = sal_True;
- }
- }
- SvLBoxContextBmp* pBmpItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
- if( pBmpItem )
- {
- aSize = GetItemSize( pView, pEntry, pBmpItem, pViewData );
- if( aSize.Width() > nMaxBmpWidth )
- {
- nMaxBmpWidth = aSize.Width();
- nMaxBmpWidth += (2*LROFFS_ICON);
- if( !(nFlags & F_GRIDMODE ) )
- bMustRecalcBoundingRects = sal_True;
- }
- if( aSize.Height() > nMaxBmpHeight )
- {
- nMaxBmpHeight = aSize.Height();
- nMaxBmpHeight += (2*TBOFFS_ICON);;
- if( !(nFlags & F_GRIDMODE ) )
- bMustRecalcBoundingRects = sal_True;
- }
- }
-}
-
-void SvImpIconView::EntryInserted( SvLBoxEntry* pEntry )
-{
- if( pModel->GetParent(pEntry) == pCurParent )
- {
- StopEditTimer();
- DBG_ASSERT(pZOrderList->GetPos(pEntry)==0xffff,"EntryInserted:ZOrder?");
- pZOrderList->Insert( pEntry, pZOrderList->Count() );
- if( nFlags & F_GRIDMODE )
- pImpCursor->Clear( sal_False );
- else
- pImpCursor->Clear( sal_True );
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
- CheckSizes( pEntry, pViewData );
- if( pView->IsUpdateMode() )
- {
- FindBoundingRect( pEntry, pViewData );
- PaintEntry( pEntry, pViewData );
- }
- else
- InvalidateBoundingRect( pViewData->aRect );
- }
-}
-
-void SvImpIconView::RemovingEntry( SvLBoxEntry* pEntry )
-{
- if( pModel->GetParent(pEntry) == pCurParent)
- {
- StopEditTimer();
- DBG_ASSERT(pZOrderList->GetPos(pEntry)!=0xffff,"RemovingEntry:ZOrder?");
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
- if( IsBoundingRectValid( pViewData->aRect ) )
- {
- // bei gueltigem Bounding-Rect muss in EntryRemoved eine
- // Sonderbehandlung erfolgen
- nFlags |= F_ENTRY_REMOVED;
- pView->Invalidate( pViewData->aRect );
- }
- if( pEntry == pCursor )
- {
- SvLBoxEntry* pNewCursor = GetNewCursor();
- ShowCursor( sal_False );
- pCursor = 0; // damit er nicht deselektiert wird
- SetCursor( pNewCursor );
- }
- sal_uInt16 nPos = pZOrderList->GetPos( (void*)pEntry );
- pZOrderList->Remove( nPos, 1 );
- pImpCursor->Clear();
- }
-}
-
-void SvImpIconView::EntryRemoved()
-{
- if( (nFlags & (F_ENTRY_REMOVED | F_PAINTED)) == (F_ENTRY_REMOVED | F_PAINTED))
- {
- // Ein Eintrag mit gueltigem BoundRect wurde geloescht und wir
- // haben schon mal gepaintet. In diesem Fall muessen wir die
- // Position des naechsten Eintrags, der eingefuegt wird oder noch
- // kein gueltiges BoundRect hat, "suchen" d.h. ein "Loch" in
- // der View auffuellen.
- nFlags &= ~( F_ENTRY_REMOVED | F_GRID_INSERT );
- }
-}
-
-
-void SvImpIconView::MovingEntry( SvLBoxEntry* pEntry )
-{
- DBG_ASSERT(pEntry,"MovingEntry: 0!");
- pNextCursor = 0;
- StopEditTimer();
- if( pModel->GetParent(pEntry) == pCurParent )
- {
- DBG_ASSERT(pZOrderList->GetPos(pEntry)!=0xffff,"MovingEntry:ZOrder?");
- nFlags |= F_MOVING_SIBLING;
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
- if( IsBoundingRectValid( pViewData->aRect ) )
- pView->Invalidate( pViewData->aRect );
- // falls Eintrag seinen Parent wechselt vorsichtshalber
- // die neue Cursorposition berechnen
- if( pEntry == pCursor )
- pNextCursor = GetNewCursor();
- pImpCursor->Clear();
- }
-}
-
-
-void SvImpIconView::EntryMoved( SvLBoxEntry* pEntry )
-{
- ShowCursor( sal_False );
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
- if( pModel->GetParent(pEntry)==pCurParent )
- {
- if( nFlags & F_MOVING_SIBLING )
- {
- // die Neu-Positionierung eines Eintrags bei D&D innerhalb
- // einer IconView findet bereits in NotifyMoving statt
- // (MovingEntry/EntryMoved wird dann nicht mehr gerufen)
- ToTop( pEntry );
- }
- else
- {
- pImpCursor->Clear();
- pZOrderList->Insert( pEntry, pZOrderList->Count() );
- DBG_ASSERT(pZOrderList->Count()==pModel->GetChildCount(pCurParent),"EntryMoved:Bad zorder count");
- FindBoundingRect( pEntry, pViewData );
- }
- PaintEntry( pEntry, pViewData );
- }
- else
- {
- if( pEntry == pCursor )
- {
- DBG_ASSERT(pNextCursor,"EntryMoved: Next cursor bad");
- SetCursor( pNextCursor );
- }
- pImpCursor->Clear();
- sal_uInt16 nPos = pZOrderList->GetPos( (void*)pEntry );
- pZOrderList->Remove( nPos, 1 );
- pView->Select( pEntry, sal_False );
- // wenn er nochmal in dieser View auftaucht, muss sein
- // Bounding-Rect neu berechnet werden
- InvalidateBoundingRect( pViewData->aRect );
- }
- nFlags &= (~F_MOVING_SIBLING);
-}
-
-void SvImpIconView::TreeInserted( SvLBoxEntry* pEntry )
-{
- EntryMoved( pEntry ); // vorlaeufig
-}
-
-void SvImpIconView::EntryExpanded( SvLBoxEntry* )
-{
-}
-
-void SvImpIconView::EntryCollapsed( SvLBoxEntry*)
-{
-}
-
-void SvImpIconView::CollapsingEntry( SvLBoxEntry* )
-{
-}
-
-void SvImpIconView::EntrySelected( SvLBoxEntry* pEntry, sal_Bool bSelect )
-{
- if( pModel->GetParent(pEntry) != pCurParent )
- return;
-
- // bei SingleSelection dafuer sorgen, dass der Cursor immer
- // auf dem (einzigen) selektierten Eintrag steht
- if( bSelect && pCursor &&
- pView->GetSelectionMode() == SINGLE_SELECTION &&
- pEntry != pCursor )
- {
- SetCursor( pEntry );
- DBG_ASSERT(pView->GetSelectionCount()==1,"selection count?");
- }
- // bei Gummibandselektion ist uns das zu teuer
- if( !(nFlags & F_RUBBERING ))
- ToTop( pEntry );
- if( pView->IsUpdateMode() )
- {
- if( pEntry == pCursor )
- ShowCursor( sal_False );
- if( nFlags & F_RUBBERING )
- PaintEntry( pEntry );
- else
- pView->Invalidate( GetBoundingRect( pEntry ) );
- if( pEntry == pCursor )
- ShowCursor( sal_True );
- }
-}
-
-void SvImpIconView::SetNextEntryPos(const Point& rPos)
-{
- aPrevBoundRect.SetPos( rPos );
- aPrevBoundRect.Right() = LONG_MAX; // dont know
-}
-
-Point SvImpIconView::FindNextEntryPos( const Size& rBoundSize )
-{
- if( nFlags & F_GRIDMODE )
- {
- if( nFlags & F_GRID_INSERT )
- {
- if( aPrevBoundRect.Right() != LONG_MAX )
- {
- // passt der naechste Entry noch in die Zeile ?
- long nNextWidth = aPrevBoundRect.Right() + nGridDX + LROFFS_WINBORDER;
- if( nNextWidth > aVirtOutputSize.Width() )
- {
- // darf aVirtOutputSize verbreitert werden ?
- if( nNextWidth < nMaxVirtWidth )
- {
- // verbreitern & in Zeile aufnehmen
- aPrevBoundRect.Left() += nGridDX;
- }
- else
- {
- // erhoehen & neue Zeile beginnen
- aPrevBoundRect.Top() += nGridDY;
- aPrevBoundRect.Left() = LROFFS_WINBORDER;
- }
- }
- else
- {
- // in die Zeile aufnehmen
- aPrevBoundRect.Left() += nGridDX;
- }
- }
- aPrevBoundRect.SetSize( Size( nGridDX, nGridDY ) );
- }
- else
- {
- if( !pImpCursor->FindEmptyGridRect( aPrevBoundRect ) )
- {
- // mitten in den Entries gibts keine Loecher mehr,
- // wir koennen also wieder ins "Fast Insert" springen
- nFlags |= F_GRID_INSERT;
- }
- }
- }
- else
- {
- if( aPrevBoundRect.Right() != LONG_MAX )
- {
- // passt der naechste Entry noch in die Zeile ?
- long nNextWidth=aPrevBoundRect.Right()+rBoundSize.Width()+LROFFS_BOUND+nHorDist;
- if( nNextWidth > aVirtOutputSize.Width() )
- {
- // darf aVirtOutputSize verbreitert werden ?
- if( nNextWidth < nMaxVirtWidth )
- {
- // verbreitern & in Zeile aufnehmen
- aPrevBoundRect.SetPos( aPrevBoundRect.TopRight() );
- aPrevBoundRect.Left() += nHorDist;
- }
- else
- {
- // erhoehen & neue Zeile beginnen
- aPrevBoundRect.Top() += nMaxBoundHeight + nVerDist + TBOFFS_BOUND;
- aPrevBoundRect.Left() = LROFFS_WINBORDER;
- }
- }
- else
- {
- // in die Zeile aufnehmen
- aPrevBoundRect.SetPos( aPrevBoundRect.TopRight() );
- aPrevBoundRect.Left() += nHorDist;
- }
- }
- aPrevBoundRect.SetSize( rBoundSize );
- }
- return aPrevBoundRect.TopLeft();
-}
-
-void SvImpIconView::ResetVirtSize()
-{
- StopEditTimer();
- aVirtOutputSize.Width() = 0;
- aVirtOutputSize.Height() = 0;
- sal_Bool bLockedEntryFound = sal_False;
- nFlags &= (~F_GRID_INSERT);
- SvLBoxEntry* pCur = pModel->FirstChild( pCurParent );
- while( pCur )
- {
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pCur);
- if( pViewData->IsEntryPosLocked() )
- {
- // VirtSize u.a. anpassen
- if( !IsBoundingRectValid( pViewData->aRect ) )
- FindBoundingRect( pCur, pViewData );
- else
- AdjustVirtSize( pViewData->aRect );
- bLockedEntryFound = sal_True;
- }
- else
- InvalidateBoundingRect( pViewData->aRect );
-
- pCur = pModel->NextSibling( pCur );
- }
- if( !bLockedEntryFound )
- {
- //XXX
- nFlags |= F_GRID_INSERT;
- }
-
- SetNextEntryPos( Point( LROFFS_WINBORDER, TBOFFS_WINBORDER ) );
- pImpCursor->Clear();
-}
-
-
-void SvImpIconView::AdjustVirtSize( const Rectangle& rRect )
-{
- long nHeightOffs = 0;
- long nWidthOffs = 0;
-
- if( aVirtOutputSize.Width() < (rRect.Right()+LROFFS_WINBORDER) )
- nWidthOffs = (rRect.Right()+LROFFS_WINBORDER) - aVirtOutputSize.Width();
-
- if( aVirtOutputSize.Height() < (rRect.Bottom()+TBOFFS_WINBORDER) )
- nHeightOffs = (rRect.Bottom()+TBOFFS_WINBORDER) - aVirtOutputSize.Height();
-
- if( nWidthOffs || nHeightOffs )
- {
- Range aRange;
- aVirtOutputSize.Width() += nWidthOffs;
- aRange.Max() = aVirtOutputSize.Width();
- aHorSBar.SetRange( aRange );
-
- aVirtOutputSize.Height() += nHeightOffs;
- aRange.Max() = aVirtOutputSize.Height();
- aVerSBar.SetRange( aRange );
-
- pImpCursor->Clear();
- AdjustScrollBars();
- }
-}
-
-void SvImpIconView::Arrange()
-{
- nMaxVirtWidth = aOutputSize.Width();
- ImpArrange();
-}
-
-void SvImpIconView::ImpArrange()
-{
- StopEditTimer();
- ShowCursor( sal_False );
- ResetVirtSize();
- bMustRecalcBoundingRects = sal_False;
- MapMode aMapMode( pView->GetMapMode());
- aMapMode.SetOrigin( Point() );
- pView->SetMapMode( aMapMode );
- CheckAllSizes();
- RecalcAllBoundingRectsSmart();
- pView->Invalidate();
- ShowCursor( sal_True );
-}
-
-void SvImpIconView::Paint( const Rectangle& rRect )
-{
- if( !pView->IsUpdateMode() )
- return;
-
-#if defined(DBG_UTIL) && defined(OV_DRAWGRID)
- if( nFlags & F_GRIDMODE )
- {
- Color aOldColor = pView->GetLineColor();
- Color aNewColor( COL_BLACK );
- pView->SetLineColor( aNewColor );
- Point aOffs( pView->GetMapMode().GetOrigin());
- Size aXSize( pView->GetOutputSizePixel() );
- for( long nDX = nGridDX; nDX <= aXSize.Width(); nDX += nGridDX )
- {
- Point aStart( nDX+LROFFS_BOUND, 0 );
- Point aEnd( nDX+LROFFS_BOUND, aXSize.Height());
- aStart -= aOffs;
- aEnd -= aOffs;
- pView->DrawLine( aStart, aEnd );
- }
- for( long nDY = nGridDY; nDY <= aXSize.Height(); nDY += nGridDY )
- {
- Point aStart( 0, nDY+TBOFFS_BOUND );
- Point aEnd( aXSize.Width(), nDY+TBOFFS_BOUND );
- aStart -= aOffs;
- aEnd -= aOffs;
- pView->DrawLine( aStart, aEnd );
- }
- pView->SetLineColor( aOldColor );
- }
-#endif
- nFlags |= F_PAINTED;
-
- if( !(pModel->HasChilds( pCurParent ) ))
- return;
- if( !pCursor )
- pCursor = pModel->FirstChild( pCurParent );
-
- sal_uInt16 nCount = pZOrderList->Count();
- if( !nCount )
- return;
-
- SvPtrarr* pNewZOrderList = new SvPtrarr;
- SvPtrarr* pPaintedEntries = new SvPtrarr;
-
- sal_uInt16 nPos = 0;
- while( nCount )
- {
- SvLBoxEntry* pEntry = (SvLBoxEntry*)(pZOrderList->GetObject(nPos ));
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
- const Rectangle& rBoundRect = GetBoundingRect( pEntry, pViewData );
- if( rRect.IsOver( rBoundRect ) )
- {
- PaintEntry( pEntry, rBoundRect.TopLeft(), pViewData );
- // Eintraege, die neu gezeichnet werden, auf Top setzen
- pPaintedEntries->Insert( pEntry, pPaintedEntries->Count() );
- }
- else
- pNewZOrderList->Insert( pEntry, pNewZOrderList->Count() );
-
- nCount--;
- nPos++;
- }
- delete pZOrderList;
- pZOrderList = pNewZOrderList;
- nCount = pPaintedEntries->Count();
- if( nCount )
- {
- for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ )
- pZOrderList->Insert( pPaintedEntries->GetObject( nCur ),pZOrderList->Count());
- }
- delete pPaintedEntries;
-
- Rectangle aRect;
- if( GetResizeRect( aRect ))
- PaintResizeRect( aRect );
-}
-
-sal_Bool SvImpIconView::GetResizeRect( Rectangle& rRect )
-{
- if( aHorSBar.IsVisible() && aVerSBar.IsVisible() )
- {
- const MapMode& rMapMode = pView->GetMapMode();
- Point aOrigin( rMapMode.GetOrigin());
- aOrigin *= -1;
- aOrigin.X() += aOutputSize.Width();
- aOrigin.Y() += aOutputSize.Height();
- rRect.SetPos( aOrigin );
- rRect.SetSize( Size( nVerSBarWidth, nHorSBarHeight));
- return sal_True;
- }
- return sal_False;
-}
-
-void SvImpIconView::PaintResizeRect( const Rectangle& rRect )
-{
- const StyleSettings& rStyleSettings = pView->GetSettings().GetStyleSettings();
- Color aNewColor = rStyleSettings.GetFaceColor();
- Color aOldColor = pView->GetFillColor();
- pView->SetFillColor( aNewColor );
- pView->DrawRect( rRect );
- pView->SetFillColor( aOldColor );
-}
-
-void SvImpIconView::RepaintSelectionItems()
-{
- OSL_FAIL("RepaintSelectionItems");
- pView->Invalidate(); // vorlaeufig
-}
-
-SvLBoxItem* SvImpIconView::GetItem( SvLBoxEntry* pEntry,
- const Point& rAbsPos )
-{
- Rectangle aRect;
- SvLBoxString* pStringItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
- if( pStringItem )
- {
- aRect = CalcTextRect( pEntry, pStringItem );
- if( aRect.IsInside( rAbsPos ) )
- return pStringItem;
- }
- SvLBoxContextBmp* pBmpItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
- if( pBmpItem )
- {
- aRect = CalcBmpRect( pEntry );
- if( aRect.IsInside( rAbsPos ) )
- return pBmpItem;
- }
- return 0;
-}
-
-void SvImpIconView::CalcDocPos( Point& aMaeuschenPos )
-{
- aMaeuschenPos -= pView->GetMapMode().GetOrigin();
-}
-
-void SvImpIconView::MouseButtonDown( const MouseEvent& rMEvt)
-{
- StopEditTimer();
- pView->GrabFocus();
- Point aDocPos( rMEvt.GetPosPixel() );
- if(aDocPos.X()>=aOutputSize.Width() || aDocPos.Y()>=aOutputSize.Height())
- return;
- CalcDocPos( aDocPos );
- SvLBoxEntry* pEntry = GetEntry( aDocPos );
- if( !pEntry )
- {
- if( pView->GetSelectionMode() != SINGLE_SELECTION )
- {
- if( !rMEvt.IsMod1() ) // Ctrl
- {
- pView->SelectAll( sal_False );
- ClearSelectedRectList();
- }
- else
- nFlags |= F_ADD_MODE;
- nFlags |= F_RUBBERING;
- aCurSelectionRect.SetPos( aDocPos );
- pView->CaptureMouse();
- }
- return;
- }
-
- sal_Bool bSelected = pView->IsSelected( pEntry );
- sal_Bool bEditingEnabled = pView->IsInplaceEditingEnabled();
-
- if( rMEvt.GetClicks() == 2 )
- {
- DeselectAllBut( pEntry );
- pView->pHdlEntry = pEntry;
- pView->DoubleClickHdl();
- }
- else
- {
- // Inplace-Editing ?
- if( rMEvt.IsMod2() ) // Alt?
- {
- if( bEditingEnabled )
- {
- SvLBoxItem* pItem = GetItem(pEntry,aDocPos);
- if( pItem )
- pView->EditingRequest( pEntry, pItem, aDocPos);
- }
- }
- else if( pView->GetSelectionMode() == SINGLE_SELECTION )
- {
- DeselectAllBut( pEntry );
- SetCursor( pEntry );
- pView->Select( pEntry, sal_True );
- if( bEditingEnabled && bSelected && !rMEvt.GetModifier() &&
- rMEvt.IsLeft() && IsTextHit( pEntry, aDocPos ) )
- {
- nFlags |= F_START_EDITTIMER_IN_MOUSEUP;
- }
- }
- else
- {
- if( !rMEvt.GetModifier() )
- {
- if( !bSelected )
- {
- DeselectAllBut( pEntry );
- SetCursor( pEntry );
- pView->Select( pEntry, sal_True );
- }
- else
- {
- // erst im Up deselektieren, falls Move per D&D!
- nFlags |= F_DOWN_DESELECT;
- if( bEditingEnabled && IsTextHit( pEntry, aDocPos ) &&
- rMEvt.IsLeft())
- {
- nFlags |= F_START_EDITTIMER_IN_MOUSEUP;
- }
- }
- }
- else if( rMEvt.IsMod1() )
- nFlags |= F_DOWN_CTRL;
- }
- }
-}
-
-void SvImpIconView::MouseButtonUp( const MouseEvent& rMEvt )
-{
- aMouseMoveTimer.Stop();
- pView->ReleaseMouse();
- // HACK, da Einar noch nicht PrepareCommandEvent aufruft
- if( rMEvt.IsRight() && (nFlags & (F_DOWN_CTRL | F_DOWN_DESELECT) ))
- nFlags &= ~(F_DOWN_CTRL | F_DOWN_DESELECT);
-
- if( nFlags & F_RUBBERING )
- {
- aMouseMoveTimer.Stop();
- AddSelectedRect( aCurSelectionRect );
- HideSelectionRect();
- nFlags &= ~(F_RUBBERING | F_ADD_MODE);
- }
-
- SvLBoxEntry* pEntry = pView->GetEntry( rMEvt.GetPosPixel(), sal_True );
- if( pEntry )
- {
- if( nFlags & F_DOWN_CTRL )
- {
- // Ctrl & MultiSelection
- ToggleSelection( pEntry );
- SetCursor( pEntry );
- }
- else if( nFlags & F_DOWN_DESELECT )
- {
- DeselectAllBut( pEntry );
- SetCursor( pEntry );
- pView->Select( pEntry, sal_True );
- }
- }
-
- nFlags &= ~(F_DOWN_CTRL | F_DOWN_DESELECT);
- if( nFlags & F_START_EDITTIMER_IN_MOUSEUP )
- {
- StartEditTimer();
- nFlags &= ~F_START_EDITTIMER_IN_MOUSEUP;
- }
-}
-
-void SvImpIconView::MouseMove( const MouseEvent& rMEvt )
-{
- if( nFlags & F_RUBBERING )
- {
- const Point& rPosPixel = rMEvt.GetPosPixel();
- if( !aMouseMoveTimer.IsActive() )
- {
- aMouseMoveEvent = rMEvt;
- aMouseMoveTimer.Start();
- // ausserhalb des Fensters liegende Move-Events muessen
- // vom Timer kommen, damit die Scrollgeschwindigkeit
- // unabhaengig von Mausbewegungen ist.
- if( rPosPixel.X() < 0 || rPosPixel.Y() < 0 )
- return;
- const Size& rSize = pView->GetOutputSizePixel();
- if( rPosPixel.X() > rSize.Width() || rPosPixel.Y() > rSize.Height())
- return;
- }
-
- if( &rMEvt != &aMouseMoveEvent )
- aMouseMoveEvent = rMEvt;
-
- long nScrollDX, nScrollDY;
-
- CalcScrollOffsets(rMEvt.GetPosPixel(),nScrollDX,nScrollDY,sal_False );
- sal_Bool bSelRectHidden = sal_False;
- if( nScrollDX || nScrollDY )
- {
- HideSelectionRect();
- bSelRectHidden = sal_True;
- pView->Scroll( nScrollDX, nScrollDY );
- }
- Point aDocPos( rMEvt.GetPosPixel() );
- aDocPos = pView->PixelToLogic( aDocPos );
- Rectangle aRect( aCurSelectionRect.TopLeft(), aDocPos );
- if( aRect != aCurSelectionRect )
- {
- HideSelectionRect();
- bSelRectHidden = sal_True;
- sal_Bool bAdd = (nFlags & F_ADD_MODE) ? sal_True : sal_False;
- SelectRect( aRect, bAdd, &aSelectedRectList );
- }
- if( bSelRectHidden )
- DrawSelectionRect( aRect );
- }
-}
-
-sal_Bool SvImpIconView::KeyInput( const KeyEvent& rKEvt )
-{
- StopEditTimer();
- sal_Bool bKeyUsed = sal_True;
- sal_Bool bMod1 = rKEvt.GetKeyCode().IsMod1();
- sal_Bool bInAddMode = (sal_Bool)((nFlags & F_ADD_MODE) != 0);
- int bDeselAll = (pView->GetSelectionMode() != SINGLE_SELECTION) &&
- !bInAddMode;
- SvLBoxEntry* pNewCursor;
- sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode();
- switch( nCode )
- {
- case KEY_UP:
- if( pCursor )
- {
- MakeVisible( pCursor );
- pNewCursor = pImpCursor->GoUpDown(pCursor,sal_False);
- if( pNewCursor )
- {
- if( bDeselAll )
- pView->SelectAll( sal_False );
- ShowCursor( sal_False );
- MakeVisible( pNewCursor );
- SetCursor( pNewCursor );
- if( !bInAddMode )
- pView->Select( pCursor, sal_True );
- }
- else
- {
- Rectangle aRect( GetBoundingRect( pCursor ) );
- if( aRect.Top())
- {
- aRect.Bottom() -= aRect.Top();
- aRect.Top() = 0;
- MakeVisible( aRect );
- }
- }
- }
- break;
-
- case KEY_DOWN:
- if( pCursor )
- {
- pNewCursor=pImpCursor->GoUpDown( pCursor,sal_True );
- if( pNewCursor )
- {
- MakeVisible( pCursor );
- if( bDeselAll )
- pView->SelectAll( sal_False );
- ShowCursor( sal_False );
- MakeVisible( pNewCursor );
- SetCursor( pNewCursor );
- if( !bInAddMode )
- pView->Select( pCursor, sal_True );
- }
- }
- break;
-
- case KEY_RIGHT:
- if( pCursor )
- {
- pNewCursor=pImpCursor->GoLeftRight(pCursor,sal_True );
- if( pNewCursor )
- {
- MakeVisible( pCursor );
- if( bDeselAll )
- pView->SelectAll( sal_False );
- ShowCursor( sal_False );
- MakeVisible( pNewCursor );
- SetCursor( pNewCursor );
- if( !bInAddMode )
- pView->Select( pCursor, sal_True );
- }
- }
- break;
-
- case KEY_LEFT:
- if( pCursor )
- {
- MakeVisible( pCursor );
- pNewCursor = pImpCursor->GoLeftRight(pCursor,sal_False );
- if( pNewCursor )
- {
- if( bDeselAll )
- pView->SelectAll( sal_False );
- ShowCursor( sal_False );
- MakeVisible( pNewCursor );
- SetCursor( pNewCursor );
- if( !bInAddMode )
- pView->Select( pCursor, sal_True );
- }
- else
- {
- Rectangle aRect( GetBoundingRect(pCursor));
- if( aRect.Left() )
- {
- aRect.Right() -= aRect.Left();
- aRect.Left() = 0;
- MakeVisible( aRect );
- }
- }
- }
- break;
-
- case KEY_ESCAPE:
- if( nFlags & F_RUBBERING )
- {
- HideSelectionRect();
- pView->SelectAll( sal_False );
- nFlags &= ~F_RUBBERING;
- }
- break;
-
- case KEY_F8:
- if( rKEvt.GetKeyCode().IsShift() )
- {
- if( nFlags & F_ADD_MODE )
- nFlags &= (~F_ADD_MODE);
- else
- nFlags |= F_ADD_MODE;
- }
- break;
-
- case KEY_SPACE:
- if( pCursor )
- {
- ToggleSelection( pCursor );
- }
- break;
-
-
- case KEY_PAGEDOWN:
- break;
- case KEY_PAGEUP:
- break;
-
- case KEY_ADD:
- case KEY_DIVIDE :
- if( bMod1 )
- pView->SelectAll( sal_True );
- break;
-
- case KEY_SUBTRACT:
- case KEY_COMMA :
- if( bMod1 )
- pView->SelectAll( sal_False );
- break;
-
- case KEY_RETURN:
- if( bMod1 )
- {
- if( pCursor && pView->IsInplaceEditingEnabled() )
- pView->EditEntry( pCursor );
- }
- break;
-
- default:
- bKeyUsed = sal_False;
-
- }
- return bKeyUsed;
-}
-
-
-void SvImpIconView::PositionScrollBars( long nRealWidth, long nRealHeight )
-{
- // hor scrollbar
- Point aPos( 0, nRealHeight );
- aPos.Y() -= nHorSBarHeight;
-
- if( aHorSBar.GetPosPixel() != aPos )
- aHorSBar.SetPosPixel( aPos );
-
- // ver scrollbar
- aPos.X() = nRealWidth; aPos.Y() = 0;
- aPos.X() -= nVerSBarWidth;
-
-#if defined(WNT)
- aPos.X()++;
- aPos.Y()--;
-#endif
-
- if( aVerSBar.GetPosPixel() != aPos )
- aVerSBar.SetPosPixel( aPos );
-}
-
-
-
-void SvImpIconView::AdjustScrollBars()
-{
- long nVirtHeight = aVirtOutputSize.Height();
- long nVirtWidth = aVirtOutputSize.Width();
-
- Size aOSize( pView->Control::GetOutputSizePixel() );
- long nRealHeight = aOSize.Height();
- long nRealWidth = aOSize.Width();
-
- PositionScrollBars( nRealWidth, nRealHeight );
-
- const MapMode& rMapMode = pView->GetMapMode();
- Point aOrigin( rMapMode.GetOrigin() );
-
- long nVisibleWidth;
- if( nRealWidth > nVirtWidth )
- nVisibleWidth = nVirtWidth + aOrigin.X();
- else
- nVisibleWidth = nRealWidth;
-
- long nVisibleHeight;
- if( nRealHeight > nVirtHeight )
- nVisibleHeight = nVirtHeight + aOrigin.Y();
- else
- nVisibleHeight = nRealHeight;
-
- bool bVerSBar = (pView->GetStyle() & WB_VSCROLL) ? true : false;
- bool bHorSBar = (pView->GetStyle() & WB_HSCROLL) ? true : false;
-
- sal_uInt16 nResult = 0;
- if( nVirtHeight )
- {
- // activate ver scrollbar ?
- if( bVerSBar || ( nVirtHeight > nVisibleHeight) )
- {
- nResult = 0x0001;
- nRealWidth -= nVerSBarWidth;
-
- if( nRealWidth > nVirtWidth )
- nVisibleWidth = nVirtWidth + aOrigin.X();
- else
- nVisibleWidth = nRealWidth;
-
- nFlags |= F_HOR_SBARSIZE_WITH_VBAR;
- }
- // activate hor scrollbar ?
- if( bHorSBar || (nVirtWidth > nVisibleWidth) )
- {
- nResult |= 0x0002;
- nRealHeight -= nHorSBarHeight;
-
- if( nRealHeight > nVirtHeight )
- nVisibleHeight = nVirtHeight + aOrigin.Y();
- else
- nVisibleHeight = nRealHeight;
-
- // brauchen wir jetzt doch eine senkrechte Scrollbar ?
- if( !(nResult & 0x0001) && // nur wenn nicht schon da
- ( (nVirtHeight > nVisibleHeight) || bVerSBar) )
- {
- nResult = 3; // both are active
- nRealWidth -= nVerSBarWidth;
-
- if( nRealWidth > nVirtWidth )
- nVisibleWidth = nVirtWidth + aOrigin.X();
- else
- nVisibleWidth = nRealWidth;
-
- nFlags |= F_VER_SBARSIZE_WITH_HBAR;
- }
- }
- }
-
- // size ver scrollbar
- long nThumb = aVerSBar.GetThumbPos();
- Size aSize( nVerSBarWidth, nRealHeight );
-#if defined(WNT)
- aSize.Height() += 2;
-#endif
- if( aSize != aVerSBar.GetSizePixel() )
- aVerSBar.SetSizePixel( aSize );
- aVerSBar.SetVisibleSize( nVisibleHeight );
- aVerSBar.SetPageSize( (nVisibleHeight*75)/100 );
- if( nResult & 0x0001 )
- {
- aVerSBar.SetThumbPos( nThumb );
- aVerSBar.Show();
- }
- else
- {
- aVerSBar.SetThumbPos( 0 );
- aVerSBar.Hide();
- }
-
- // size hor scrollbar
- nThumb = aHorSBar.GetThumbPos();
- aSize.Width() = nRealWidth;
- aSize.Height() = nHorSBarHeight;
-#if defined(WNT)
- aSize.Width()++;
-#endif
-#if defined(WNT)
- if( nResult & 0x0001 ) // vertikale Scrollbar ?
- {
- aSize.Width()++;
- nRealWidth++;
- }
-#endif
- if( aSize != aHorSBar.GetSizePixel() )
- aHorSBar.SetSizePixel( aSize );
- aHorSBar.SetVisibleSize( nVisibleWidth ); //nRealWidth );
- aHorSBar.SetPageSize( (nVisibleWidth*75)/100 );
- if( nResult & 0x0002 )
- {
- aHorSBar.SetThumbPos( nThumb );
- aHorSBar.Show();
- }
- else
- {
- aHorSBar.SetThumbPos( 0 );
- aHorSBar.Hide();
- }
-
- aOutputSize.Width() = nRealWidth;
-#if defined(WNT)
- if( nResult & 0x0002 ) // hor scrollbar ?
- nRealHeight++; // weil unterer Rand geclippt wird
-#endif
- aOutputSize.Height() = nRealHeight;
-}
-
-void SvImpIconView::Resize()
-{
- StopEditTimer();
- Rectangle aRect;
- if( GetResizeRect(aRect) )
- pView->Invalidate( aRect );
- aOutputSize = pView->GetOutputSizePixel();
- pImpCursor->Clear();
-
-#if 1
- const Size& rSize = pView->Control::GetOutputSizePixel();
- PositionScrollBars( rSize.Width(), rSize.Height() );
- // Die ScrollBars werden asynchron ein/ausgeblendet, damit abgeleitete
- // Klassen im Resize ein Arrange durchfuehren koennen, ohne dass
- // die ScrollBars aufblitzen (SfxExplorerIconView!)
- nCurUserEvent = Application::PostUserEvent(LINK(this,SvImpIconView,UserEventHdl),0);
-#else
- AdjustScrollBars();
- if( GetResizeRect(aRect) )
- PaintResizeRect( aRect );
-#endif
-}
-
-sal_Bool SvImpIconView::CheckHorScrollBar()
-{
- if( !pZOrderList || !aHorSBar.IsVisible() )
- return sal_False;
- const MapMode& rMapMode = pView->GetMapMode();
- Point aOrigin( rMapMode.GetOrigin() );
- if(!(pView->GetStyle() & WB_HSCROLL) && !aOrigin.X() )
- {
- long nWidth = aOutputSize.Width();
- sal_uInt16 nCount = pZOrderList->Count();
- long nMostRight = 0;
- for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ )
- {
- SvLBoxEntry* pEntry = (SvLBoxEntry*)pZOrderList->operator[](nCur);
- long nRight = GetBoundingRect(pEntry).Right();
- if( nRight > nWidth )
- return sal_False;
- if( nRight > nMostRight )
- nMostRight = nRight;
- }
- aHorSBar.Hide();
- aOutputSize.Height() += nHorSBarHeight;
- aVirtOutputSize.Width() = nMostRight;
- aHorSBar.SetThumbPos( 0 );
- Range aRange;
- aRange.Max() = nMostRight - 1;
- aHorSBar.SetRange( aRange );
- if( aVerSBar.IsVisible() )
- {
- Size aSize( aVerSBar.GetSizePixel());
- aSize.Height() += nHorSBarHeight;
- aVerSBar.SetSizePixel( aSize );
- }
- return sal_True;
- }
- return sal_False;
-}
-
-sal_Bool SvImpIconView::CheckVerScrollBar()
-{
- if( !pZOrderList || !aVerSBar.IsVisible() )
- return sal_False;
- const MapMode& rMapMode = pView->GetMapMode();
- Point aOrigin( rMapMode.GetOrigin() );
- if(!(pView->GetStyle() & WB_VSCROLL) && !aOrigin.Y() )
- {
- long nDeepest = 0;
- long nHeight = aOutputSize.Height();
- sal_uInt16 nCount = pZOrderList->Count();
- for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ )
- {
- SvLBoxEntry* pEntry = (SvLBoxEntry*)pZOrderList->operator[](nCur);
- long nBottom = GetBoundingRect(pEntry).Bottom();
- if( nBottom > nHeight )
- return sal_False;
- if( nBottom > nDeepest )
- nDeepest = nBottom;
- }
- aVerSBar.Hide();
- aOutputSize.Width() += nVerSBarWidth;
- aVirtOutputSize.Height() = nDeepest;
- aVerSBar.SetThumbPos( 0 );
- Range aRange;
- aRange.Max() = nDeepest - 1;
- aVerSBar.SetRange( aRange );
- if( aHorSBar.IsVisible() )
- {
- Size aSize( aHorSBar.GetSizePixel());
- aSize.Width() += nVerSBarWidth;
- aHorSBar.SetSizePixel( aSize );
- }
- return sal_True;
- }
- return sal_False;
-}
-
-
-// blendet Scrollbars aus, wenn sie nicht mehr benoetigt werden
-void SvImpIconView::CheckScrollBars()
-{
- CheckVerScrollBar();
- if( CheckHorScrollBar() )
- CheckVerScrollBar();
-}
-
-
-void SvImpIconView::GetFocus()
-{
- if( pCursor )
- {
- pView->SetEntryFocus( pCursor, sal_True );
- ShowCursor( sal_True );
- }
-}
-
-void SvImpIconView::LoseFocus()
-{
- StopEditTimer();
- if( pCursor )
- pView->SetEntryFocus( pCursor,sal_False );
- ShowCursor( sal_False );
-}
-
-void SvImpIconView::UpdateAll()
-{
- AdjustScrollBars();
- pImpCursor->Clear();
- pView->Invalidate();
-}
-
-void SvImpIconView::PaintEntry( SvLBoxEntry* pEntry, SvIcnVwDataEntry* pViewData )
-{
- Point aPos( GetEntryPosition( pEntry ) );
- PaintEntry( pEntry, aPos, pViewData );
-}
-
-void SvImpIconView::PaintEmphasis( const Rectangle& rRect, sal_Bool bSelected,
- sal_Bool bCursored, OutputDevice* pOut )
-{
- // HACK fuer D&D
- if( nFlags & F_NO_EMPHASIS )
- return;
-
- if( !pOut )
- pOut = pView;
-
- // Selektion painten
- Color aOldFillColor = pOut->GetFillColor();
- Color aOldLineColor = pOut->GetLineColor();
- Color aNewColor;
- const StyleSettings& rStyleSettings = pOut->GetSettings().GetStyleSettings();
- if( bSelected )
- {
- aNewColor = rStyleSettings.GetHighlightColor();
- }
- else
- {
- aNewColor =rStyleSettings.GetFieldColor();
- }
-
- if( bCursored )
- {
- pOut->SetLineColor( Color( COL_BLACK ) );
- }
- pOut->SetFillColor( aNewColor );
- pOut->DrawRect( rRect );
- pOut->SetFillColor( aOldFillColor );
- pOut->SetLineColor( aOldLineColor );
-}
-
-void SvImpIconView::PaintItem( const Rectangle& rRect,
- SvLBoxItem* pItem, SvLBoxEntry* pEntry, sal_uInt16 nPaintFlags,
- OutputDevice* pOut )
-{
- if( nViewMode == VIEWMODE_ICON && pItem->IsA() == SV_ITEM_ID_LBOXSTRING )
- {
- const String& rStr = ((SvLBoxString*)pItem)->GetText();
- DrawText( pOut, rRect, rStr, DRAWTEXT_FLAGS );
- }
- else
- {
- Point aPos( rRect.TopLeft() );
- const Size& rSize = GetItemSize( pView, pEntry, pItem );
- if( nPaintFlags & PAINTFLAG_HOR_CENTERED )
- aPos.X() += (rRect.GetWidth() - rSize.Width() ) / 2;
- if( nPaintFlags & PAINTFLAG_VER_CENTERED )
- aPos.Y() += (rRect.GetHeight() - rSize.Height() ) / 2;
- pItem->Paint( aPos, *(SvLBox*)pOut, 0, pEntry );
- }
-}
-
-void SvImpIconView::PaintEntry( SvLBoxEntry* pEntry, const Point& rPos,
- SvIcnVwDataEntry* pViewData, OutputDevice* pOut )
-{
- if( !pView->IsUpdateMode() )
- return;
-
- if( !pOut )
- pOut = pView;
-
- SvLBoxContextBmp* pBmpItem;
-
- pView->PreparePaint( pEntry );
-
- if( !pViewData )
- pViewData = ICNVIEWDATA(pEntry);
-
- SvLBoxString* pStringItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
-
- sal_Bool bSelected = pViewData->IsSelected();
- sal_Bool bCursored = pViewData->IsCursored();
-
- Font aTempFont( pOut->GetFont() );
- // waehrend D&D nicht die Fontfarbe wechseln, da sonst auch die
- // Emphasis gezeichnet werden muss! (weisser Adler auf weissem Grund)
- if( bSelected && !(nFlags & F_NO_EMPHASIS) )
- {
- const StyleSettings& rStyleSettings = pOut->GetSettings().GetStyleSettings();
- Font aNewFont( aTempFont );
- aNewFont.SetColor( rStyleSettings.GetHighlightTextColor() );
- pOut->SetFont( aNewFont );
- }
- Rectangle aTextRect( CalcTextRect(pEntry,pStringItem,&rPos,sal_False,pViewData));
- Rectangle aBmpRect( CalcBmpRect(pEntry, &rPos, pViewData ) );
-
- switch( nViewMode )
- {
- case VIEWMODE_ICON:
- pBmpItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
- PaintEmphasis( aBmpRect, bSelected, bCursored, pOut );
- PaintItem( aBmpRect, pBmpItem, pEntry,
- PAINTFLAG_HOR_CENTERED | PAINTFLAG_VER_CENTERED, pOut );
- PaintEmphasis( aTextRect, bSelected, sal_False, pOut );
- PaintItem( aTextRect, pStringItem, pEntry, PAINTFLAG_HOR_CENTERED, pOut );
- break;
-
- case VIEWMODE_NAME:
- pBmpItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
- PaintEmphasis( aBmpRect, bSelected, bCursored, pOut );
- PaintItem( aBmpRect, pBmpItem, pEntry, PAINTFLAG_VER_CENTERED, pOut );
- PaintEmphasis( aTextRect, bSelected, sal_False, pOut );
- PaintItem( aTextRect, pStringItem, pEntry,PAINTFLAG_VER_CENTERED, pOut );
- break;
-
- case VIEWMODE_TEXT:
- PaintEmphasis( aTextRect, bSelected, bCursored, pOut );
- PaintItem( aTextRect, pStringItem, pEntry, PAINTFLAG_VER_CENTERED, pOut );
- break;
- }
- pOut->SetFont( aTempFont );
-}
-
-void SvImpIconView::SetEntryPosition( SvLBoxEntry* pEntry, const Point& rPos,
- sal_Bool bAdjustAtGrid, sal_Bool bCheckScrollBars )
-{
- if( pModel->GetParent(pEntry) == pCurParent )
- {
- ShowCursor( sal_False );
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
- Rectangle aBoundRect( GetBoundingRect( pEntry, pViewData ));
- pView->Invalidate( aBoundRect );
- ToTop( pEntry );
- if( rPos != aBoundRect.TopLeft() )
- {
- Point aGridOffs = pViewData->aGridRect.TopLeft() -
- pViewData->aRect.TopLeft();
- pImpCursor->Clear();
- nFlags &= ~F_GRID_INSERT;
- aBoundRect.SetPos( rPos );
- pViewData->aRect = aBoundRect;
- pViewData->aGridRect.SetPos( rPos + aGridOffs );
- AdjustVirtSize( aBoundRect );
- }
- //HACK(Billigloesung, die noch verbessert werden muss)
- if( bAdjustAtGrid )
- {
- AdjustAtGrid( pEntry );
- ToTop( pEntry );
- }
- if( bCheckScrollBars && pView->IsUpdateMode() )
- CheckScrollBars();
-
- PaintEntry( pEntry, pViewData );
- ShowCursor( sal_True );
- }
-}
-
-void SvImpIconView::ViewDataInitialized( SvLBoxEntry*)
-{
-}
-
-void SvImpIconView::ModelHasEntryInvalidated( SvListEntry* pEntry )
-{
- if( pEntry == pCursor )
- ShowCursor( sal_False );
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
- pView->Invalidate( pViewData->aRect );
-
- if( nFlags & F_GRIDMODE )
- Center( (SvLBoxEntry*)pEntry, pViewData );
- else
- pViewData->aRect.SetSize( CalcBoundingSize(
- (SvLBoxEntry*)pEntry, pViewData ) );
-
- ViewDataInitialized( (SvLBoxEntry*)pEntry );
- pView->Invalidate( pViewData->aRect );
- if( pEntry == pCursor )
- ShowCursor( sal_True );
-}
-
-
-void SvImpIconView::InvalidateEntry( SvLBoxEntry* pEntry )
-{
- const Rectangle& rRect = GetBoundingRect( pEntry );
- pView->Invalidate( rRect );
-}
-
-void SvImpIconView::SetNoSelection()
-{
-}
-
-void SvImpIconView::SetDragDropMode( DragDropMode )
-{
-}
-
-void SvImpIconView::SetSelectionMode( SelectionMode )
-{
-}
-
-sal_Bool SvImpIconView::IsEntryInView( SvLBoxEntry* )
-{
- return sal_False;
-}
-
-SvLBoxEntry* SvImpIconView::GetDropTarget( const Point& rPos )
-{
- Point aDocPos( rPos );
- CalcDocPos( aDocPos );
- SvLBoxEntry* pTarget = GetEntry( aDocPos );
- if( !pTarget || !pTarget->HasChilds() )
- pTarget = pCurParent;
- return pTarget;
-}
-
-SvLBoxEntry* SvImpIconView::GetEntry( const Point& rDocPos )
-{
- CheckBoundingRects();
- SvLBoxEntry* pTarget = 0;
- // Z-Order-Liste vom Ende her absuchen
- sal_uInt16 nCount = pZOrderList->Count();
- while( nCount )
- {
- nCount--;
- SvLBoxEntry* pEntry = (SvLBoxEntry*)(pZOrderList->GetObject(nCount));
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
- if( pViewData->aRect.IsInside( rDocPos ) )
- {
- pTarget = pEntry;
- break;
- }
- }
- return pTarget;
-}
-
-SvLBoxEntry* SvImpIconView::GetNextEntry( const Point& rDocPos, SvLBoxEntry* pCurEntry )
-{
- CheckBoundingRects();
- SvLBoxEntry* pTarget = 0;
- sal_uInt16 nStartPos = pZOrderList->GetPos( (void*)pCurEntry );
- if( nStartPos != USHRT_MAX )
- {
- sal_uInt16 nCount = pZOrderList->Count();
- for( sal_uInt16 nCur = nStartPos+1; nCur < nCount; nCur++ )
- {
- SvLBoxEntry* pEntry = (SvLBoxEntry*)(pZOrderList->GetObject(nCur));
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
- if( pViewData->aRect.IsInside( rDocPos ) )
- {
- pTarget = pEntry;
- break;
- }
- }
- }
- return pTarget;
-}
-
-SvLBoxEntry* SvImpIconView::GetPrevEntry( const Point& rDocPos, SvLBoxEntry* pCurEntry )
-{
- CheckBoundingRects();
- SvLBoxEntry* pTarget = 0;
- sal_uInt16 nStartPos = pZOrderList->GetPos( (void*)pCurEntry );
- if( nStartPos != USHRT_MAX && nStartPos != 0 )
- {
- nStartPos--;
- do
- {
- SvLBoxEntry* pEntry = (SvLBoxEntry*)(pZOrderList->GetObject(nStartPos));
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
- if( pViewData->aRect.IsInside( rDocPos ) )
- {
- pTarget = pEntry;
- break;
- }
- } while( nStartPos > 0 );
- }
- return pTarget;
-}
-
-
-Point SvImpIconView::GetEntryPosition( SvLBoxEntry* pEntry )
-{
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
- DBG_ASSERT(pViewData,"Entry not in model");
- return pViewData->aRect.TopLeft();
-}
-
-const Rectangle& SvImpIconView::GetBoundingRect( SvLBoxEntry* pEntry, SvIcnVwDataEntry* pViewData )
-{
- if( !pViewData )
- pViewData = ICNVIEWDATA(pEntry);
- DBG_ASSERT(pViewData,"Entry not in model");
- if( !IsBoundingRectValid( pViewData->aRect ))
- FindBoundingRect( pEntry, pViewData );
- return pViewData->aRect;
-}
-
-void SvImpIconView::SetSpaceBetweenEntries( long nHor, long nVer )
-{
- nHorDist = nHor;
- nVerDist = nVer;
-}
-
-Rectangle SvImpIconView::CalcBmpRect( SvLBoxEntry* pEntry, const Point* pPos,
- SvIcnVwDataEntry* pViewData )
-{
- if( !pViewData )
- pViewData = ICNVIEWDATA(pEntry);
-
- Rectangle aBound = GetBoundingRect( pEntry, pViewData );
- if( pPos )
- aBound.SetPos( *pPos );
- Point aPos( aBound.TopLeft() );
-
- switch( nViewMode )
- {
- case VIEWMODE_ICON:
- {
- aPos.X() += ( aBound.GetWidth() - nMaxBmpWidth ) / 2;
- Size aSize( nMaxBmpWidth, nMaxBmpHeight );
- // das Bitmap-Rechteck soll nicht das TextRect beruehren
- aSize.Height() -= 3;
- return Rectangle( aPos, aSize );
- }
-
- case VIEWMODE_NAME:
- return Rectangle( aPos,
- Size( nMaxBmpWidth, aBound.GetHeight() ));
-
- case VIEWMODE_TEXT:
- return Rectangle( aPos, aBound.GetSize() );
-
- default:
- {
- Rectangle aRect;
- return aRect;
- }
- }
-}
-
-Rectangle SvImpIconView::CalcTextRect( SvLBoxEntry* pEntry,
- SvLBoxString* pItem, const Point* pPos, sal_Bool bForInplaceEdit,
- SvIcnVwDataEntry* pViewData )
-{
- long nBmpHeight, nBmpWidth;
-
- if( !pItem )
- pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
-
- if( !pViewData )
- pViewData = ICNVIEWDATA(pEntry);
-
- Size aTextSize( GetItemSize( pView, pEntry, pItem, pViewData ));
- aTextSize.Width() += 2*LROFFS_TEXT;
-
- Size aContextBmpSize(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)->GetSize(pView,pEntry));
- Rectangle aBound = GetBoundingRect( pEntry, pViewData );
- if( pPos )
- aBound.SetPos( *pPos );
- Point aPos( aBound.TopLeft() );
-
- switch( nViewMode )
- {
- case VIEWMODE_ICON:
- nBmpHeight = aContextBmpSize.Height();
- if( nBmpHeight < nMaxBmpHeight )
- nBmpHeight = nMaxBmpHeight;
- aPos.Y() += nBmpHeight;
-
- // beim Inplace-Editieren, spendieren wir ein bisschen mehr Platz
- if( bForInplaceEdit )
- {
- // 20% rauf
- long nMinWidth = (( (aContextBmpSize.Width()*10) / 100 ) * 2 ) +
- aContextBmpSize.Width();
- if( nMinWidth > aBound.GetWidth() )
- nMinWidth = aBound.GetWidth();
-
- if( aTextSize.Width() < nMinWidth )
- aTextSize.Width() = nMinWidth;
-
- // beim Inplace-Ed. darfs auch untere Eintraege ueberlappen
- Rectangle aMaxGridTextRect = CalcMaxTextRect(pEntry, pViewData);
- Size aOptSize = aMaxGridTextRect.GetSize();
- if( aOptSize.Height() > aTextSize.Height() )
- aTextSize.Height() = aOptSize.Height();
- }
-
-
- aPos.X() += ( aBound.GetWidth() - aTextSize.Width() ) / 2;
- break;
-
- case VIEWMODE_NAME:
- nBmpWidth = aContextBmpSize.Width();
- if( nBmpWidth < nMaxBmpWidth )
- nBmpWidth = nMaxBmpWidth;
- aPos.X() += nBmpWidth;
- // vertikal ausrichten
- aPos.Y() += ( nBmpWidth - aTextSize.Height() ) / 2;
- break;
- }
-
- Rectangle aRect( aPos, aTextSize );
-// KNALLT BEIM D&D, WENN GECLIPPT WIRD (In DrawText von Thomas)
-// ClipAtVirtOutRect( aRect );
- return aRect;
-}
-
-
-long SvImpIconView::CalcBoundingWidth( SvLBoxEntry* pEntry,
- const SvIcnVwDataEntry* pViewData ) const
-{
- DBG_ASSERT(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP),"No Bitmaps");
- DBG_ASSERT(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING),"No Text");
- long nStringWidth = GetItemSize( pView, pEntry, pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING),pViewData).Width();
- nStringWidth += 2*LROFFS_TEXT;
- long nBmpWidth = pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)->GetSize(pView,pEntry).Width();
- long nWidth = 0;
-
- switch( nViewMode )
- {
- case VIEWMODE_ICON:
- nWidth = Max( nStringWidth, nBmpWidth );
- nWidth = Max( nWidth, nMaxBmpWidth );
- break;
-
- case VIEWMODE_NAME:
- nWidth = Max( nBmpWidth, nMaxBmpWidth );
- nWidth += NAMEVIEW_OFFS_BMP_STRING; // Abstand Bitmap String
- nWidth += nStringWidth;
- break;
-
- case VIEWMODE_TEXT:
- nWidth = nStringWidth;
- break;
- }
- return nWidth;
-}
-
-long SvImpIconView::CalcBoundingHeight( SvLBoxEntry* pEntry,
- const SvIcnVwDataEntry* pViewData ) const
-{
- DBG_ASSERT(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP),"No Bitmaps");
- DBG_ASSERT(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING),"No Text");
- long nStringHeight = GetItemSize(pView,pEntry,pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING),pViewData).Height();
- long nBmpHeight = pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)->GetSize(pView,pEntry).Height();
- long nHeight = 0;
-
- switch( nViewMode )
- {
- case VIEWMODE_ICON:
- nHeight = Max( nBmpHeight, nMaxBmpHeight );
- nHeight += ICONVIEW_OFFS_BMP_STRING; // Abstand Bitmap String
- nHeight += nStringHeight;
- break;
-
- case VIEWMODE_NAME:
- nHeight = Max( nBmpHeight, nMaxBmpHeight );
- nHeight = Max( nHeight, nStringHeight );
- break;
-
- case VIEWMODE_TEXT:
- nHeight = nStringHeight;
- break;
- }
- if( nHeight > nMaxBoundHeight )
- {
- ((SvImpIconView*)this)->nMaxBoundHeight = nHeight;
- ((SvImpIconView*)this)->aHorSBar.SetLineSize( nHeight / 2 );
- ((SvImpIconView*)this)->aVerSBar.SetLineSize( nHeight / 2 );
- }
- return nHeight;
-}
-
-Size SvImpIconView::CalcBoundingSize( SvLBoxEntry* pEntry,
- SvIcnVwDataEntry* pViewData ) const
-{
- if( !pViewData )
- pViewData = ICNVIEWDATA(pEntry);
- return Size( CalcBoundingWidth(pEntry,pViewData),
- CalcBoundingHeight(pEntry,pViewData) );
-}
-
-void SvImpIconView::RecalcAllBoundingRects()
-{
- nMaxBoundHeight = 0;
- pZOrderList->Remove(0, pZOrderList->Count() );
- SvLBoxEntry* pEntry = pModel->FirstChild( pCurParent );
- while( pEntry )
- {
- FindBoundingRect( pEntry );
- pZOrderList->Insert( pEntry, pZOrderList->Count() );
- pEntry = pModel->NextSibling( pEntry );
- }
- bMustRecalcBoundingRects = sal_False;
- AdjustScrollBars();
-}
-
-void SvImpIconView::RecalcAllBoundingRectsSmart()
-{
- nMaxBoundHeight = 0;
- pZOrderList->Remove(0, pZOrderList->Count() );
- SvLBoxEntry* pEntry = pModel->FirstChild( pCurParent );
- while( pEntry )
- {
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
- if( IsBoundingRectValid( pViewData->aRect ))
- {
- Size aBoundSize( pViewData->aRect.GetSize() );
- if( aBoundSize.Height() > nMaxBoundHeight )
- nMaxBoundHeight = aBoundSize.Height();
- pZOrderList->Insert( pEntry, pZOrderList->Count() );
- }
- else
- {
- FindBoundingRect( pEntry, pViewData );
- }
- pZOrderList->Insert( pEntry, pZOrderList->Count() );
- pEntry = pModel->NextSibling( pEntry );
- }
- AdjustScrollBars();
-}
-
-void SvImpIconView::UpdateBoundingRects()
-{
- SvLBoxEntry* pEntry = pModel->FirstChild( pCurParent );
- while( pEntry )
- {
- GetBoundingRect( pEntry );
- pEntry = pModel->NextSibling( pEntry );
- }
-}
-
-void SvImpIconView::FindBoundingRect( SvLBoxEntry* pEntry,
- SvIcnVwDataEntry* pViewData )
-{
- if( !pViewData )
- pViewData = ICNVIEWDATA(pEntry);
-
- Size aSize( CalcBoundingSize( pEntry, pViewData ) );
- Point aPos;
-
- DBG_ASSERT(!pViewData->IsEntryPosLocked(),"Locked entry pos in FindBoundingRect");
- // damits in der IconView nicht drunter & drueber geht
- if( pViewData->IsEntryPosLocked() && IsBoundingRectValid(pViewData->aRect) )
- {
- AdjustVirtSize( pViewData->aRect );
- return;
- }
-
- aPos = FindNextEntryPos( aSize );
-
- if( nFlags & F_GRIDMODE )
- {
- Rectangle aGridRect( aPos, Size(nGridDX, nGridDY) );
- pViewData->aGridRect = aGridRect;
- Center( pEntry, pViewData );
- AdjustVirtSize( pViewData->aRect );
- pImpCursor->SetGridUsed( pViewData->aRect );
- }
- else
- {
- pViewData->aRect = Rectangle( aPos, aSize );
- AdjustVirtSize( pViewData->aRect );
- }
-}
-
-
-void SvImpIconView::SetCursor( SvLBoxEntry* pEntry )
-{
- if( pEntry == pCursor )
- return;
-
- ShowCursor( sal_False );
- if( pCursor )
- {
- pView->SetEntryFocus( pCursor, sal_False );
- if( pView->GetSelectionMode() == SINGLE_SELECTION )
- pView->Select( pCursor, sal_False );
- }
- pCursor = pEntry;
- ToTop( pCursor );
- if( pCursor )
- {
- pView->SetEntryFocus(pCursor, sal_True );
- if( pView->GetSelectionMode() == SINGLE_SELECTION )
- pView->Select( pCursor, sal_True );
- ShowCursor( sal_True );
- }
-}
-
-
-void SvImpIconView::ShowCursor( sal_Bool bShow )
-{
- if( !pCursor || !bShow || !pView->HasFocus() )
- {
- pView->HideFocus();
- return;
- }
- Rectangle aRect ( CalcFocusRect( pCursor ) );
- pView->ShowFocus( aRect );
-}
-
-
-void SvImpIconView::HideDDIcon()
-{
- pView->Update();
- ImpHideDDIcon();
- pDDBufDev = pDDDev;
- pDDDev = 0;
-}
-
-void SvImpIconView::ImpHideDDIcon()
-{
- if( pDDDev )
- {
- Size aSize( pDDDev->GetOutputSizePixel() );
- // pView restaurieren
- pView->DrawOutDev( aDDLastRectPos, aSize, Point(), aSize, *pDDDev );
- }
-}
-
-
-void SvImpIconView::ShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPosPix )
-{
- pView->Update();
- if( pRefEntry != pDDRefEntry )
- {
- DELETEZ(pDDDev);
- DELETEZ(pDDBufDev);
- }
- sal_Bool bSelected = pView->SvListView::Select( pRefEntry, sal_False );
- if( !pDDDev )
- {
- if( pDDBufDev )
- {
- // nicht bei jedem Move ein Device anlegen, da dies besonders
- // auf Remote-Clients zu langsam ist
- pDDDev = pDDBufDev;
- pDDBufDev = 0;
- }
- else
- {
- pDDDev = new VirtualDevice( *pView );
- pDDDev->SetFont( pView->GetFont() );
- }
- }
- else
- {
- ImpHideDDIcon();
- }
- const Rectangle& rRect = GetBoundingRect( pRefEntry );
- pDDDev->SetOutputSizePixel( rRect.GetSize() );
-
- Point aPos( rPosPix );
- CalcDocPos( aPos );
-
- Size aSize( pDDDev->GetOutputSizePixel() );
- pDDRefEntry = pRefEntry;
- aDDLastEntryPos = aPos;
- aDDLastRectPos = aPos;
-
- // Hintergrund sichern
- pDDDev->DrawOutDev( Point(), aSize, aPos, aSize, *pView );
- // Icon in pView malen
- nFlags |= F_NO_EMPHASIS;
- PaintEntry( pRefEntry, aPos );
- nFlags &= ~F_NO_EMPHASIS;
- if( bSelected )
- pView->SvListView::Select( pRefEntry, sal_True );
-}
-
-void SvImpIconView::HideShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPosPix )
-{
-/* In Notfaellen folgenden flackernden Code aktivieren:
-
- HideDDIcon();
- ShowDDIcon( pRefEntry, rPosPix );
- return;
-*/
- if( !pDDDev )
- {
- ShowDDIcon( pRefEntry, rPosPix );
- return;
- }
-
- if( pRefEntry != pDDRefEntry )
- {
- HideDDIcon();
- ShowDDIcon( pRefEntry, rPosPix );
- return;
- }
-
- Point aEmptyPoint;
-
- Point aCurEntryPos( rPosPix );
- CalcDocPos( aCurEntryPos );
-
- const Rectangle& rRect = GetBoundingRect( pRefEntry );
- Size aEntrySize( rRect.GetSize() );
- Rectangle aPrevEntryRect( aDDLastEntryPos, aEntrySize );
- Rectangle aCurEntryRect( aCurEntryPos, aEntrySize );
-
- if( !aPrevEntryRect.IsOver( aCurEntryRect ) )
- {
- HideDDIcon();
- ShowDDIcon( pRefEntry, rPosPix );
- return;
- }
-
- // Ueberlappung des neuen und alten D&D-Pointers!
-
- Rectangle aFullRect( aPrevEntryRect.Union( aCurEntryRect ) );
- if( !pDDTempDev )
- {
- pDDTempDev = new VirtualDevice( *pView );
- pDDTempDev->SetFont( pView->GetFont() );
- }
-
- Size aFullSize( aFullRect.GetSize() );
- Point aFullPos( aFullRect.TopLeft() );
-
- pDDTempDev->SetOutputSizePixel( aFullSize );
-
- // Hintergrund (mit dem alten D&D-Pointer!) sichern
- pDDTempDev->DrawOutDev( aEmptyPoint, aFullSize, aFullPos, aFullSize, *pView );
- // den alten Buffer in den neuen Buffer pasten
- aDDLastRectPos = aDDLastRectPos - aFullPos;
-
- pDDTempDev->DrawOutDev(
- aDDLastRectPos,
- pDDDev->GetOutputSizePixel(),
- aEmptyPoint,
- pDDDev->GetOutputSizePixel(),
- *pDDDev );
-
- // Swap
- VirtualDevice* pTemp = pDDDev;
- pDDDev = pDDTempDev;
- pDDTempDev = pTemp;
-
- // in den restaurierten Hintergrund den neuen D&D-Pointer zeichnen
- pDDTempDev->SetOutputSizePixel( pDDDev->GetOutputSizePixel() );
- pDDTempDev->DrawOutDev(
- aEmptyPoint, aFullSize, aEmptyPoint, aFullSize, *pDDDev );
- Point aRelPos = aCurEntryPos - aFullPos;
- nFlags |= F_NO_EMPHASIS;
- PaintEntry( pRefEntry, aRelPos, 0, pDDTempDev );
- nFlags &= ~F_NO_EMPHASIS;
-
- aDDLastRectPos = aFullPos;
- aDDLastEntryPos = aCurEntryPos;
-
- pView->DrawOutDev(
- aDDLastRectPos,
- pDDDev->GetOutputSizePixel(),
- aEmptyPoint,
- pDDDev->GetOutputSizePixel(),
- *pDDTempDev );
-
- sal_Bool bSelected = pView->SvListView::Select( pRefEntry, sal_False );
- if( bSelected )
- pView->SvListView::Select( pRefEntry, sal_True );
-}
-
-void SvImpIconView::ShowTargetEmphasis( SvLBoxEntry* pEntry, sal_Bool )
-{
- CheckBoundingRects();
- Rectangle aRect;
- if( pEntry != pCurParent &&
- (pEntry->HasChilds() || pEntry->HasChildsOnDemand()) )
- aRect = CalcBmpRect( pEntry );
- else
- {
- aRect.SetSize( aOutputSize );
- const MapMode& rMapMode = pView->GetMapMode();
- Point aOrigin( rMapMode.GetOrigin());
- aOrigin *= -1; // in Doc-Koord wandeln
- aRect.SetPos( aOrigin );
- aRect.Left()++; aRect.Top()++;
- aRect.Right()--; aRect.Bottom()--;
- }
- ImpDrawXORRect( aRect );
-}
-
-sal_Bool SvImpIconView::NotifyMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry,
- SvLBoxEntry*& rpNewPar, sal_uLong& rNewChildPos )
-{
- if( pTarget == pCurParent && pModel->GetParent(pEntry) == pCurParent )
- {
- // D&D innerhalb einer Childlist
- StopEditTimer();
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
- Size aSize( pViewData->aRect.GetSize() );
- Point aNewPos = FindNextEntryPos( aSize );
- AdjustVirtSize( Rectangle( aNewPos, aSize ) );
- SetEntryPosition( pEntry, aNewPos, sal_False, sal_True );
- return sal_False;
- }
- return pView->SvLBox::NotifyMoving(pTarget,pEntry,rpNewPar,rNewChildPos);
-}
-
-sal_Bool SvImpIconView::NotifyCopying( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry,
- SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos )
-{
- return pView->SvLBox::NotifyCopying(pTarget,pEntry,rpNewParent,rNewChildPos);
-}
-
-void SvImpIconView::WriteDragServerInfo( const Point& rPos, SvLBoxDDInfo* pInfo)
-{
- SvLBoxEntry* pCurEntry = GetCurEntry();
- Point aEntryPos;
- if( pCurEntry )
- {
- aEntryPos = rPos;
- aEntryPos -= GetEntryPosition( pCurEntry );
- }
- pInfo->nMouseRelX = aEntryPos.X();
- pInfo->nMouseRelY = aEntryPos.Y();
-}
-
-void SvImpIconView::ReadDragServerInfo( const Point& rPos, SvLBoxDDInfo* pInfo )
-{
- Point aDropPos( rPos );
- aDropPos.X() -= pInfo->nMouseRelX;
- aDropPos.Y() -= pInfo->nMouseRelY;
- SetNextEntryPos( aDropPos );
-}
-
-void SvImpIconView::InvalidateBoundingRect( SvLBoxEntry* pEntry )
-{
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
- InvalidateBoundingRect( pViewData->aRect );
-}
-
-void SvImpIconView::PrepareCommandEvent( const Point& rPt )
-{
- aMouseMoveTimer.Stop();
- StopEditTimer();
- nFlags |= F_CMD_ARRIVED;
- SvLBoxEntry* pEntry = pView->GetEntry( rPt, sal_True );
- if( (nFlags & F_DOWN_CTRL) && pEntry && !pView->IsSelected(pEntry) )
- pView->Select( pEntry, sal_True );
- nFlags &= ~(F_DOWN_CTRL | F_DOWN_DESELECT);
-}
-
-void SvImpIconView::SttDrag( const Point& rPos )
-{
- PrepareCommandEvent( rPos );
-
- nFlags |= F_DRAG_SOURCE;
- ShowCursor( sal_False );
-}
-
-void SvImpIconView::EndDrag()
-{
- ShowCursor( sal_True );
- nFlags &= (~F_DRAG_SOURCE);
-}
-
-void SvImpIconView::ToTop( SvLBoxEntry* pEntry )
-{
- DBG_ASSERT(pZOrderList->GetPos(pEntry)!=0xffff,"ToTop:ZOrder?");
- if( pZOrderList->GetObject( pZOrderList->Count() -1 ) != pEntry )
- {
- sal_uInt16 nPos = pZOrderList->GetPos( (void*)pEntry );
- pZOrderList->Remove( nPos, 1 );
- pZOrderList->Insert( pEntry, pZOrderList->Count() );
- }
-}
-
-void SvImpIconView::SetCurParent( SvLBoxEntry* pNewParent )
-{
- Clear();
- pCurParent = pNewParent;
- ImpArrange();
-}
-
-void SvImpIconView::ClipAtVirtOutRect( Rectangle& rRect ) const
-{
- if( rRect.Bottom() >= aVirtOutputSize.Height() )
- rRect.Bottom() = aVirtOutputSize.Height() - 1;
- if( rRect.Right() >= aVirtOutputSize.Width() )
- rRect.Right() = aVirtOutputSize.Width() - 1;
- if( rRect.Top() < 0 )
- rRect.Top() = 0;
- if( rRect.Left() < 0 )
- rRect.Left() = 0;
-}
-
-// rRect: Bereich des Dokumentes (in Dokumentkoordinaten), der
-// sichtbar gemacht werden soll.
-// bScrBar == sal_True: Das Rect wurde aufgrund eines ScrollBar-Events berechnet
-
-void SvImpIconView::MakeVisible( const Rectangle& rRect, sal_Bool bScrBar )
-{
- Rectangle aRect( rRect );
- ClipAtVirtOutRect( aRect );
- MapMode aMapMode( pView->GetMapMode() );
- Point aOrigin( aMapMode.GetOrigin() );
- // in Dokumentkoordinate umwandeln
- aOrigin *= -1;
-
- Rectangle aOutputArea( aOrigin, aOutputSize );
- if( aOutputArea.IsInside( aRect ) )
- return; // ist schon sichtbar
-
- long nDy;
- if( aRect.Top() < aOutputArea.Top() )
- {
- // nach oben scrollen (nDy < 0)
- nDy = aRect.Top() - aOutputArea.Top();
- }
- else if( aRect.Bottom() > aOutputArea.Bottom() )
- {
- // nach unten scrollen (nDy > 0)
- nDy = aRect.Bottom() - aOutputArea.Bottom();
- }
- else
- nDy = 0;
-
- long nDx;
- if( aRect.Left() < aOutputArea.Left() )
- {
- // nach links scrollen (nDx < 0)
- nDx = aRect.Left() - aOutputArea.Left();
- }
- else if( aRect.Right() > aOutputArea.Right() )
- {
- // nach rechts scrollen (nDx > 0)
- nDx = aRect.Right() - aOutputArea.Right();
- }
- else
- nDx = 0;
-
- aOrigin.X() += nDx;
- aOrigin.Y() += nDy;
- aOutputArea.SetPos( aOrigin );
-
- pView->Update();
-
- // Origin fuer SV invertieren (damit wir in
- // Dokumentkoordinaten scrollen/painten koennen)
- aOrigin *= -1;
- aMapMode.SetOrigin( aOrigin );
- pView->SetMapMode( aMapMode );
-
- // in umgekehrte Richtung scrollen!
- pView->Control::Scroll( -nDx, -nDy, aOutputArea, sal_True );
- if( aHorSBar.IsVisible() || aVerSBar.IsVisible() )
- {
- if( !bScrBar )
- {
- aOrigin *= -1;
- // Thumbs korrigieren
- if(aHorSBar.IsVisible() && aHorSBar.GetThumbPos() != aOrigin.X())
- aHorSBar.SetThumbPos( aOrigin.X() );
- if(aVerSBar.IsVisible() && aVerSBar.GetThumbPos() != aOrigin.Y())
- aVerSBar.SetThumbPos( aOrigin.Y() );
- }
- }
- // pruefen, ob ScrollBars noch benoetigt werden
- CheckScrollBars();
- pView->Update();
-}
-
-
-SvLBoxEntry* SvImpIconView::GetNewCursor()
-{
- SvLBoxEntry* pNewCursor;
- if( pCursor )
- {
- pNewCursor = pImpCursor->GoLeftRight( pCursor, sal_False );
- if( !pNewCursor )
- {
- pNewCursor = pImpCursor->GoLeftRight( pCursor, sal_True );
- if( !pNewCursor )
- {
- pNewCursor = pImpCursor->GoUpDown( pCursor, sal_False );
- if( !pNewCursor )
- pNewCursor = pImpCursor->GoUpDown( pCursor, sal_True );
- }
- }
- }
- else
- pNewCursor = pModel->FirstChild( pCurParent );
- DBG_ASSERT(!pNewCursor|| (pCursor&&pCursor!=pNewCursor),"GetNewCursor failed");
- return pNewCursor;
-}
-
-
-sal_uInt16 SvImpIconView:: GetSelectionCount() const
-{
- sal_uInt16 nSelected = 0;
- SvLBoxEntry* pEntry = pModel->FirstChild( pCurParent);
- while( pEntry )
- {
- if( pView->IsSelected( pEntry ) )
- nSelected++;
- pEntry = pModel->NextSibling( pEntry );
- }
- return nSelected;
-}
-
-
-void SvImpIconView::ToggleSelection( SvLBoxEntry* pEntry )
-{
- sal_Bool bSel;
- if( pView->IsSelected( pEntry ) )
- bSel = sal_False;
- else
- bSel = sal_True;
- pView->Select( pEntry, bSel );
-}
-
-void SvImpIconView::DeselectAllBut( SvLBoxEntry* pThisEntryNot )
-{
- ClearSelectedRectList();
- SvLBoxEntry* pEntry = pModel->FirstChild( pCurParent );
- while( pEntry )
- {
- if( pEntry != pThisEntryNot && pView->IsSelected( pEntry ))
- pView->Select( pEntry, sal_False );
- pEntry = pModel->NextSibling( pEntry );
- }
-}
-
-#define ICN_ROWS 50
-#define ICN_COLS 30
-
-ImpIcnCursor::ImpIcnCursor( SvImpIconView* pOwner )
-{
- pView = pOwner;
- pColumns = 0;
- pRows = 0;
- pCurEntry = 0;
- nDeltaWidth = 0;
- nDeltaHeight= 0;
- nCols = 0;
- nRows = 0;
- nGridCols = 0;
- nGridRows = 0;
- pGridMap = 0;
-}
-
-ImpIcnCursor::~ImpIcnCursor()
-{
- delete[] pColumns;
- delete[] pRows;
- delete pGridMap;
-}
-
-sal_uInt16 ImpIcnCursor::GetSortListPos( SvPtrarr* pList, long nValue,
- int bVertical )
-{
- sal_uInt16 nCount = (sal_uInt16)pList->Count();
- if( !nCount )
- return 0;
-
- sal_uInt16 nCurPos = 0;
- long nPrevValue = LONG_MIN;
- while( nCount )
- {
- const Rectangle& rRect=
- pView->GetBoundingRect((SvLBoxEntry*)(pList->GetObject(nCurPos)));
- long nCurValue;
- if( bVertical )
- nCurValue = rRect.Top();
- else
- nCurValue = rRect.Left();
- if( nValue >= nPrevValue && nValue <= nCurValue )
- return (sal_uInt16)nCurPos;
- nPrevValue = nCurValue;
- nCount--;
- nCurPos++;
- }
- return pList->Count();
-}
-
-void ImpIcnCursor::ImplCreate()
-{
- pView->CheckBoundingRects();
- DBG_ASSERT(pColumns==0&&pRows==0,"ImplCreate: Not cleared");
-
- SetDeltas();
-
- pColumns = new SvPtrarr[ nCols ];
- pRows = new SvPtrarr[ nRows ];
-
- DELETEZ(pGridMap);
-
- SvLBoxTreeList* pModel = pView->pModel;
- SvLBoxEntry* pEntry = pModel->FirstChild( pView->pCurParent );
- while( pEntry )
- {
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA2(pEntry);
- // const Rectangle& rRect = pView->GetBoundingRect( pEntry );
- Rectangle rRect( pView->CalcBmpRect( pEntry,0,pViewData ) );
- short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / nDeltaHeight );
- short nX = (short)( ((rRect.Left()+rRect.Right())/2) / nDeltaWidth );
-
- // Rundungsfehler abfangen
- if( nY >= nRows )
- nY = sal::static_int_cast< short >(nRows - 1);
- if( nX >= nCols )
- nX = sal::static_int_cast< short >(nCols - 1);
-
- sal_uInt16 nIns = GetSortListPos( &pColumns[nX], rRect.Top(), sal_True );
- pColumns[ nX ].Insert( pEntry, nIns );
-
- nIns = GetSortListPos( &pRows[nY], rRect.Left(), sal_False );
- pRows[ nY ].Insert( pEntry, nIns );
-
- pViewData->nX = nX;
- pViewData->nY = nY;
-
- pEntry = pModel->NextSibling( pEntry );
- }
-}
-
-void ImpIcnCursor::CreateGridMap()
-{
- if( pGridMap )
- return;
-
- const Size& rSize = pView->aVirtOutputSize;
- long nWidth = rSize.Width();
- if( nWidth < pView->nMaxVirtWidth )
- nWidth = pView->nMaxVirtWidth;
- nWidth -= 2*LROFFS_WINBORDER;
- if( nWidth <= 0 )
- nWidth = 1;
-
- nGridDX = pView->nGridDX;
- nGridDY = pView->nGridDY;
-
- // Hinweis: Wegen der Abrundung bei Berechnung von nGridCols
- // ist es moeglich, dass Eintrage nicht im Grid liegen. Diese
- // wurden typischerweise manuell verschoben und gelockt
- nGridCols = nWidth / nGridDX;
- if( !nGridCols ) nGridCols = 1;
-
- nGridRows = rSize.Height() / nGridDY;
- // nRows nicht abrunden, da zur Vermeidung von Ueberlappungen
- // das gesamte BoundingRect des Eintrags zur Markierung im Grid
- // herangezogen wird.
- if( (nGridRows * nGridDY) < rSize.Height() )
- nGridRows++;
- else if( !nGridRows )
- nGridRows = 1;
-
- //XXX
- //nGridRows += 50; // in fuenfziger-Schritten
-
- pGridMap = new sal_Bool[ nGridRows*nGridCols];
- memset( (void*)pGridMap, 0, nGridRows*nGridCols );
-
- SvLBoxTreeList* pModel = pView->pModel;
- SvLBoxEntry* pEntry = pModel->FirstChild( pView->pCurParent );
- while( pEntry )
- {
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA2(pEntry);
- const Rectangle& rRect = pViewData->aRect;
- // nur, wenn der Entry schon plaziert ist
- if( pView->IsBoundingRectValid( rRect ))
- {
- // Alle vom Eintrag beruehrten Grids kennzeichnen
- SetGridUsed( pView->GetBoundingRect( pEntry, pViewData ) );
- }
- pEntry = pModel->NextSibling( pEntry );
- }
-}
-
-sal_Bool ImpIcnCursor::GetGrid( const Point& rDocPos, sal_uInt16& rGridX, sal_uInt16& rGridY ) const
-{
- Point aPos( rDocPos );
- aPos.X() -= LROFFS_WINBORDER;
- aPos.Y() -= TBOFFS_WINBORDER;
- rGridX = (sal_uInt16)(aPos.X() / nGridDX);
- rGridY = (sal_uInt16)(aPos.Y() / nGridDY);
- sal_Bool bInGrid = sal_True;
- if( rGridX >= nGridCols )
- {
- rGridX = sal::static_int_cast< sal_uInt16 >(nGridCols - 1);
- bInGrid = sal_False;
- }
- if( rGridY >= nGridRows )
- {
- rGridY = sal::static_int_cast< sal_uInt16 >(nGridRows - 1);
- if( !bInGrid )
- return sal_False; // beide Koordinaten nicht im Grid
- }
- return sal_True;
-}
-
-void ImpIcnCursor::SetGridUsed( const Rectangle& rRect, sal_Bool bUsed )
-{
- CreateGridMap();
- sal_uInt16 nTLX, nTLY, nBRX, nBRY;
-
- sal_Bool bTLInGrid = GetGrid( rRect.TopLeft(), nTLX, nTLY );
- sal_Bool bBRInGrid = GetGrid( rRect.BottomRight(), nBRX, nBRY );
-
- if( !bTLInGrid && !bBRInGrid )
- return;
-
- for( sal_uInt16 nCurY = nTLY; nCurY <= nBRY; nCurY++ )
- {
- for( sal_uInt16 nCurX = nTLX; nCurX <= nBRX; nCurX++ )
- {
- SetGridUsed( nCurX, nCurY, bUsed );
- }
- }
-}
-
-void ImpIcnCursor::Clear( sal_Bool bGridToo )
-{
- if( pColumns )
- {
- delete[] pColumns;
- delete[] pRows;
- pColumns = 0;
- pRows = 0;
- pCurEntry = 0;
- nDeltaWidth = 0;
- nDeltaHeight = 0;
- }
- if( bGridToo && pGridMap )
- {
- DELETEZ(pGridMap);
- nGridRows = 0;
- nGridCols = 0;
- }
-}
-
-SvLBoxEntry* ImpIcnCursor::SearchCol(sal_uInt16 nCol,sal_uInt16 nTop,sal_uInt16 nBottom,
- sal_uInt16, sal_Bool bDown, sal_Bool bSimple )
-{
- DBG_ASSERT(pCurEntry,"SearchCol: No reference entry");
- SvPtrarr* pList = &(pColumns[ nCol ]);
- sal_uInt16 nCount = pList->Count();
- if( !nCount )
- return 0;
-
- const Rectangle& rRefRect = pView->GetBoundingRect(pCurEntry);
-
- if( bSimple )
- {
- sal_uInt16 nListPos = pList->GetPos( pCurEntry );
- DBG_ASSERT(nListPos!=0xffff,"Entry not in Col-List");
- if( bDown )
- {
- while( nListPos < nCount-1 )
- {
- nListPos++;
- SvLBoxEntry* pEntry = (SvLBoxEntry*)pList->GetObject( nListPos );
- const Rectangle& rRect = pView->GetBoundingRect( pEntry );
- if( rRect.Top() > rRefRect.Top() )
- return pEntry;
- }
- return 0;
- }
- else
- {
- while( nListPos )
- {
- nListPos--;
- if( nListPos < nCount )
- {
- SvLBoxEntry* pEntry = (SvLBoxEntry*)pList->GetObject( nListPos );
- const Rectangle& rRect = pView->GetBoundingRect( pEntry );
- if( rRect.Top() < rRefRect.Top() )
- return pEntry;
- }
- }
- return 0;
- }
- }
-
- if( nTop > nBottom )
- {
- sal_uInt16 nTemp = nTop;
- nTop = nBottom;
- nBottom = nTemp;
- }
- long nMinDistance = LONG_MAX;
- SvLBoxEntry* pResult = 0;
- for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ )
- {
- SvLBoxEntry* pEntry = (SvLBoxEntry*)(pList->GetObject( nCur ));
- if( pEntry != pCurEntry )
- {
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA2(pEntry);
- sal_uInt16 nY = pViewData->nY;
- if( nY >= nTop && nY <= nBottom )
- {
- const Rectangle& rRect = pView->GetBoundingRect( pEntry );
- long nDistance = rRect.Top() - rRefRect.Top();
- if( nDistance < 0 )
- nDistance *= -1;
- if( nDistance && nDistance < nMinDistance )
- {
- nMinDistance = nDistance;
- pResult = pEntry;
- }
- }
- }
- }
- return pResult;
-}
-
-SvLBoxEntry* ImpIcnCursor::SearchRow(sal_uInt16 nRow,sal_uInt16 nLeft,sal_uInt16 nRight,
- sal_uInt16, sal_Bool bRight, sal_Bool bSimple )
-{
- DBG_ASSERT(pCurEntry,"SearchRow: No reference entry");
- SvPtrarr* pList = &(pRows[ nRow ]);
- sal_uInt16 nCount = pList->Count();
- if( !nCount )
- return 0;
-
- const Rectangle& rRefRect = pView->GetBoundingRect(pCurEntry);
-
- if( bSimple )
- {
- sal_uInt16 nListPos = pList->GetPos( pCurEntry );
- DBG_ASSERT(nListPos!=0xffff,"Entry not in Row-List");
- if( bRight )
- {
- while( nListPos < nCount-1 )
- {
- nListPos++;
- SvLBoxEntry* pEntry = (SvLBoxEntry*)pList->GetObject( nListPos );
- const Rectangle& rRect = pView->GetBoundingRect( pEntry );
- if( rRect.Left() > rRefRect.Left() )
- return pEntry;
- }
- return 0;
- }
- else
- {
- while( nListPos )
- {
- nListPos--;
- if( nListPos < nCount )
- {
- SvLBoxEntry* pEntry = (SvLBoxEntry*)pList->GetObject( nListPos );
- const Rectangle& rRect = pView->GetBoundingRect( pEntry );
- if( rRect.Left() < rRefRect.Left() )
- return pEntry;
- }
- }
- return 0;
- }
-
- }
- if( nRight < nLeft )
- {
- sal_uInt16 nTemp = nRight;
- nRight = nLeft;
- nLeft = nTemp;
- }
- long nMinDistance = LONG_MAX;
- SvLBoxEntry* pResult = 0;
- for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ )
- {
- SvLBoxEntry* pEntry = (SvLBoxEntry*)(pList->GetObject( nCur ));
- if( pEntry != pCurEntry )
- {
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA2(pEntry);
- sal_uInt16 nX = pViewData->nX;
- if( nX >= nLeft && nX <= nRight )
- {
- const Rectangle& rRect = pView->GetBoundingRect( pEntry );
- long nDistance = rRect.Left() - rRefRect.Left();
- if( nDistance < 0 )
- nDistance *= -1;
- if( nDistance && nDistance < nMinDistance )
- {
- nMinDistance = nDistance;
- pResult = pEntry;
- }
- }
- }
- }
- return pResult;
-}
-
-
-
-/*
- Sucht ab dem uebergebenen Eintrag den naechsten rechts- bzw.
- linksstehenden. Suchverfahren am Beispiel bRight = sal_True:
-
- c
- b c
- a b c
- S 1 1 1 ====> Suchrichtung
- a b c
- b c
- c
-
- S : Startposition
- 1 : erstes Suchrechteck
- a,b,c : 2., 3., 4. Suchrechteck
-*/
-
-SvLBoxEntry* ImpIcnCursor::GoLeftRight( SvLBoxEntry* pIcnEntry, sal_Bool bRight )
-{
- SvLBoxEntry* pResult;
- pCurEntry = pIcnEntry;
- Create();
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA2(pIcnEntry);
- sal_uInt16 nY = pViewData->nY;
- sal_uInt16 nX = pViewData->nX;
- DBG_ASSERT(nY< nRows,"GoLeftRight:Bad column");
- DBG_ASSERT(nX< nCols,"GoLeftRight:Bad row");
- // Nachbar auf gleicher Zeile ?
- if( bRight )
- pResult = SearchRow(
- nY, nX, sal::static_int_cast< sal_uInt16 >(nCols-1), nX, sal_True, sal_True );
- else
- pResult = SearchRow( nY, nX ,0, nX, sal_False, sal_True );
- if( pResult )
- return pResult;
-
- long nCurCol = nX;
-
- long nColOffs, nLastCol;
- if( bRight )
- {
- nColOffs = 1;
- nLastCol = nCols;
- }
- else
- {
- nColOffs = -1;
- nLastCol = -1; // 0-1
- }
-
- sal_uInt16 nRowMin = nY;
- sal_uInt16 nRowMax = nY;
- do
- {
- SvLBoxEntry* pEntry = SearchCol((sal_uInt16)nCurCol,nRowMin,nRowMax,nY,sal_True, sal_False);
- if( pEntry )
- return pEntry;
- if( nRowMin )
- nRowMin--;
- if( nRowMax < (nRows-1))
- nRowMax++;
- nCurCol += nColOffs;
- } while( nCurCol != nLastCol );
- return 0;
-}
-
-SvLBoxEntry* ImpIcnCursor::GoUpDown( SvLBoxEntry* pIcnEntry, sal_Bool bDown)
-{
- SvLBoxEntry* pResult;
- pCurEntry = pIcnEntry;
- Create();
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA2(pIcnEntry);
- sal_uInt16 nY = pViewData->nY;
- sal_uInt16 nX = pViewData->nX;
- DBG_ASSERT(nY<nRows,"GoUpDown:Bad column");
- DBG_ASSERT(nX<nCols,"GoUpDown:Bad row");
-
- // Nachbar in gleicher Spalte ?
- if( bDown )
- pResult = SearchCol(
- nX, nY, sal::static_int_cast< sal_uInt16 >(nRows-1), nY, sal_True, sal_True );
- else
- pResult = SearchCol( nX, nY ,0, nY, sal_False, sal_True );
- if( pResult )
- return pResult;
-
- long nCurRow = nY;
-
- long nRowOffs, nLastRow;
- if( bDown )
- {
- nRowOffs = 1;
- nLastRow = nRows;
- }
- else
- {
- nRowOffs = -1;
- nLastRow = -1; // 0-1
- }
-
- sal_uInt16 nColMin = nX;
- sal_uInt16 nColMax = nX;
- do
- {
- SvLBoxEntry* pEntry = SearchRow((sal_uInt16)nCurRow,nColMin,nColMax,nX,sal_True, sal_False);
- if( pEntry )
- return pEntry;
- if( nColMin )
- nColMin--;
- if( nColMax < (nCols-1))
- nColMax++;
- nCurRow += nRowOffs;
- } while( nCurRow != nLastRow );
- return 0;
-}
-
-void ImpIcnCursor::SetDeltas()
-{
- const Size& rSize = pView->aVirtOutputSize;
- if( pView->nFlags & F_GRIDMODE )
- {
- nGridDX = pView->nGridDX;
- nGridDY = pView->nGridDY;
- }
- else
- {
- nGridDX = 20;
- nGridDY = 20;
- }
- nCols = rSize.Width() / nGridDX;
- if( !nCols )
- nCols = 1;
- nRows = rSize.Height() / nGridDY;
- if( (nRows * nGridDY) < rSize.Height() )
- nRows++;
- if( !nRows )
- nRows = 1;
-
- nDeltaWidth = (short)(rSize.Width() / nCols);
- nDeltaHeight = (short)(rSize.Height() / nRows);
- if( !nDeltaHeight )
- {
- nDeltaHeight = 1;
- DBG_WARNING("SetDeltas:Bad height");
- }
- if( !nDeltaWidth )
- {
- nDeltaWidth = 1;
- DBG_WARNING("SetDeltas:Bad width");
- }
-}
-
-sal_Bool ImpIcnCursor::FindEmptyGridRect( Rectangle& rRect )
-{
- CreateGridMap();
- sal_uInt16 nCount = (sal_uInt16)(nGridCols * nGridRows);
- if( !nCount )
- return sal_False;
- for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ )
- {
- if( !pGridMap[ nCur ] )
- {
- sal_uInt16 nCol = (sal_uInt16)(nCur % nGridCols);
- sal_uInt16 nRow = (sal_uInt16)(nCur / nGridCols);
- rRect.Top() = nRow * nGridDY + TBOFFS_WINBORDER;
- rRect.Bottom() = rRect.Top() + nGridDY;
- rRect.Left() = nCol * nGridDX+ LROFFS_WINBORDER;
- rRect.Right() = rRect.Left() + nGridDX;
- SetGridUsed( nCol, nRow, sal_True );
-
- DBG_ASSERT(pGridMap[nCur],"SetGridUsed failed");
- return sal_True;
- }
- }
- // Gridmap ist voll: Um eine Zeile erweitern
- rRect.Top() = nGridRows * nGridDY + TBOFFS_WINBORDER;
- rRect.Bottom() = rRect.Top() + nGridDY;
- rRect.Left() = LROFFS_WINBORDER;
- rRect.Right() = rRect.Left() + nGridDX;
- return sal_False;
-}
-
-void ImpIcnCursor::CreateGridAjustData( SvPtrarr& rLists, SvLBoxEntry* pRefEntry)
-{
- if( !pRefEntry )
- {
- sal_uInt16 nAdjustRows = (sal_uInt16)(pView->aVirtOutputSize.Height() / pView->nGridDY);
- nAdjustRows++; // wg. Abrundung!
-
- if( !nAdjustRows )
- return;
- for( sal_uInt16 nCurList = 0; nCurList < nAdjustRows; nCurList++ )
- {
- SvPtrarr* pRow = new SvPtrarr;
- rLists.Insert( (void*)pRow, nCurList );
- }
- SvLBoxEntry* pEntry = pView->pModel->FirstChild( pView->pCurParent );
- while( pEntry )
- {
- const Rectangle& rRect = pView->GetBoundingRect( pEntry );
- short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / pView->nGridDY );
- sal_uInt16 nIns = GetSortListPos((SvPtrarr*)rLists[nY],rRect.Left(),sal_False);
- ((SvPtrarr*)rLists[ nY ])->Insert( pEntry, nIns );
- pEntry = pView->pModel->NextSibling( pEntry );
- }
- }
- else
- {
- // Aufbau eines hor. "Schlauchs" auf der RefEntry-Zeile
-
- // UEBERLEGEN: BoundingRect nehmen wg. Ueberlappungen???
-
- Rectangle rRefRect( pView->CalcBmpRect( pRefEntry ) );
- //const Rectangle& rRefRect = pView->GetBoundingRect( pRefEntry );
- short nRefRow = (short)( ((rRefRect.Top()+rRefRect.Bottom())/2) / pView->nGridDY );
- SvPtrarr* pRow = new SvPtrarr;
- rLists.Insert( (void*)pRow, 0 );
- SvLBoxEntry* pEntry = pView->pModel->FirstChild( pView->pCurParent );
- while( pEntry )
- {
- Rectangle rRect( pView->CalcBmpRect(pEntry) );
- //const Rectangle& rRect = pView->GetBoundingRect( pEntry );
- short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / pView->nGridDY );
- if( nY == nRefRow )
- {
- sal_uInt16 nIns = GetSortListPos( pRow, rRect.Left(), sal_False );
- pRow->Insert( pEntry, nIns );
- }
- pEntry = pView->pModel->NextSibling( pEntry );
- }
- }
-}
-
-//static
-void ImpIcnCursor::DestroyGridAdjustData( SvPtrarr& rLists )
-{
- sal_uInt16 nCount = rLists.Count();
- for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ )
- {
- SvPtrarr* pArr = (SvPtrarr*)rLists[ nCur ];
- delete pArr;
- }
- rLists.Remove( 0, rLists.Count() );
-}
-
-void SvImpIconView::SetGrid( long nDX, long nDY )
-{
- nGridDX = nDX;
- nGridDY = nDY;
- nFlags |= F_GRIDMODE;
-}
-
-Rectangle SvImpIconView::CalcMaxTextRect( const SvLBoxEntry* pEntry,
- const SvIcnVwDataEntry* pViewData ) const
-{
- Rectangle aRect = pViewData->aGridRect;
- long nBmpHeight = ((SvLBoxEntry*)pEntry)->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)->GetSize(pView,(SvLBoxEntry*)pEntry).Height();
- aRect.Top() += nBmpHeight;
- aRect.Top() += ICONVIEW_OFFS_BMP_STRING;
- if( aRect.Top() > aRect.Bottom())
- aRect.Top() = aRect.Bottom();
- aRect.Left() += LROFFS_BOUND;
- aRect.Left()++;
- aRect.Right() -= LROFFS_BOUND;
- aRect.Right()--;
- if( aRect.Left() > aRect.Right())
- aRect.Left() = aRect.Right();
- if( GetTextMode( pEntry, pViewData ) == ShowTextFull )
- aRect.Bottom() = LONG_MAX;
- return aRect;
-}
-
-void SvImpIconView::Center( SvLBoxEntry* pEntry,
- SvIcnVwDataEntry* pViewData ) const
-{
- SvLBoxString* pStringItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
- const String& rEntryText = pStringItem->GetText();
-
- Rectangle aTextRect = CalcMaxTextRect(pEntry,pViewData);
- aTextRect = GetTextRect( pView, aTextRect, rEntryText, DRAWTEXT_FLAGS );
- pViewData->aTextSize = aTextRect.GetSize();
-
- pViewData->aRect = pViewData->aGridRect;
- Size aSize( CalcBoundingSize( pEntry, pViewData ) );
- long nBorder = pViewData->aGridRect.GetWidth() - aSize.Width();
- pViewData->aRect.Left() += nBorder / 2;
- pViewData->aRect.Right() -= nBorder / 2;
- pViewData->aRect.Bottom() = pViewData->aRect.Top() + aSize.Height();
-}
-
-
-// Die Deltas entsprechen Offsets, um die die View auf dem Doc verschoben wird
-// links, hoch: Offsets < 0
-// rechts, runter: Offsets > 0
-void SvImpIconView::Scroll( long nDeltaX, long nDeltaY, sal_Bool bScrollBar )
-{
- const MapMode& rMapMode = pView->GetMapMode();
- Point aOrigin( rMapMode.GetOrigin() );
- // in Dokumentkoordinate umwandeln
- aOrigin *= -1;
- aOrigin.Y() += nDeltaY;
- aOrigin.X() += nDeltaX;
- Rectangle aRect( aOrigin, aOutputSize );
- MakeVisible( aRect, bScrollBar );
-}
-
-
-const Size& SvImpIconView::GetItemSize( SvIconView* pIconView,
- SvLBoxEntry* pEntry, SvLBoxItem* pItem, const SvIcnVwDataEntry* pViewData) const
-{
- if( (nFlags & F_GRIDMODE) && pItem->IsA() == SV_ITEM_ID_LBOXSTRING )
- {
- if( !pViewData )
- pViewData = ICNVIEWDATA(pEntry);
- return pViewData->aTextSize;
- }
- else
- return pItem->GetSize( pIconView, pEntry );
-}
-
-Rectangle SvImpIconView::CalcFocusRect( SvLBoxEntry* pEntry )
-{
- SvLBoxString* pStringItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
- DBG_ASSERT(pStringItem,"Text not set");
- return CalcTextRect( pEntry, pStringItem );
-}
-
-
-void SvImpIconView::SelectRect( const Rectangle& rRect, sal_Bool bAdd,
- SvPtrarr* pOtherRects, short nBorderOffs )
-{
- if( !pZOrderList || !pZOrderList->Count() )
- return;
-
- CheckBoundingRects();
- pView->Update();
- sal_uInt16 nCount = pZOrderList->Count();
-
- Rectangle aRect( rRect );
- aRect.Justify();
- if( nBorderOffs )
- {
- aRect.Left() -= nBorderOffs;
- aRect.Right() += nBorderOffs;
- aRect.Top() -= nBorderOffs;
- aRect.Bottom() += nBorderOffs;
- }
- sal_Bool bCalcOverlap = (bAdd && pOtherRects && pOtherRects->Count()) ? sal_True : sal_False;
-
- for( sal_uInt16 nPos = 0; nPos < nCount; nPos++ )
- {
- SvLBoxEntry* pEntry = (SvLBoxEntry*)(pZOrderList->GetObject(nPos ));
-
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
- DBG_ASSERT(pViewData,"Entry not in model");
- if( !IsBoundingRectValid( pViewData->aRect ))
- FindBoundingRect( pEntry, pViewData );
- const Rectangle& rBoundRect = pViewData->aRect;
- sal_Bool bSelected = pViewData->IsSelected();
-
- sal_Bool bOverlaps;
- if( bCalcOverlap )
- bOverlaps = IsOver( pOtherRects, rBoundRect );
- else
- bOverlaps = sal_False;
- sal_Bool bOver = aRect.IsOver( rBoundRect );
-
- if( bOver && !bOverlaps )
- {
- // Ist im neuen Selektionsrechteck und in keinem alten
- // => selektieren
- if( !bSelected )
- pView->Select( pEntry, sal_True );
- }
- else if( !bAdd )
- {
- // ist ausserhalb des Selektionsrechtecks
- // => Selektion entfernen
- if( bSelected )
- pView->Select( pEntry, sal_False );
- }
- else if( bAdd && bOverlaps )
- {
- // Der Eintrag befindet sich in einem alten (=>Aufspannen
- // mehrerer Rechtecke mit Ctrl!) Selektionsrechteck
-
- // Hier ist noch ein Bug! Der Selektionsstatus eines Eintrags
- // in einem vorherigen Rechteck, muss restauriert werden, wenn
- // er vom aktuellen Selektionsrechteck beruehrt wurde, jetzt aber
- // nicht mehr in ihm liegt. Ich gehe hier der Einfachheit halber
- // pauschal davon aus, dass die Eintraege in den alten Rechtecken
- // alle selektiert sind. Ebenso ist es falsch, die Schnittmenge
- // nur zu deselektieren.
- // Loesungsmoeglichkeit: Snapshot der Selektion vor dem Auf-
- // spannen des Rechtecks merken
- if( rBoundRect.IsOver( rRect))
- {
- // Schnittmenge zwischen alten Rects & aktuellem Rect desel.
- if( bSelected )
- pView->Select( pEntry, sal_False );
- }
- else
- {
- // Eintrag eines alten Rects selektieren
- if( !bSelected )
- pView->Select( pEntry, sal_True );
- }
- }
- else if( !bOver && bSelected )
- {
- // Der Eintrag liegt voellig ausserhalb und wird deshalb desel.
- pView->Select( pEntry, sal_False );
- }
- }
- pView->Update();
-}
-
-sal_Bool SvImpIconView::IsOver( SvPtrarr* pRectList, const Rectangle& rBoundRect ) const
-{
- sal_uInt16 nCount = pRectList->Count();
- for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ )
- {
- Rectangle* pRect = (Rectangle*)pRectList->GetObject( nCur );
- if( rBoundRect.IsOver( *pRect ))
- return sal_True;
- }
- return sal_False;
-}
-
-void SvImpIconView::AddSelectedRect( const Rectangle& rRect, short nBorderOffs )
-{
- Rectangle* pRect = new Rectangle( rRect );
- pRect->Justify();
- if( nBorderOffs )
- {
- pRect->Left() -= nBorderOffs;
- pRect->Right() += nBorderOffs;
- pRect->Top() -= nBorderOffs;
- pRect->Bottom() += nBorderOffs;
- }
- aSelectedRectList.Insert( (void*)pRect, aSelectedRectList.Count() );
-}
-
-void SvImpIconView::ClearSelectedRectList()
-{
- sal_uInt16 nCount = aSelectedRectList.Count();
- for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ )
- {
- Rectangle* pRect = (Rectangle*)aSelectedRectList.GetObject( nCur );
- delete pRect;
- }
- aSelectedRectList.Remove( 0, aSelectedRectList.Count() );
-}
-
-
-void SvImpIconView::DrawSelectionRect( const Rectangle& rRect )
-{
- pView->HideTracking();
- nFlags |= F_SELRECT_VISIBLE;
- pView->ShowTracking( rRect, SHOWTRACK_SMALL | SHOWTRACK_WINDOW );
- aCurSelectionRect = rRect;
-}
-
-void SvImpIconView::HideSelectionRect()
-{
- if( nFlags & F_SELRECT_VISIBLE )
- {
- pView->HideTracking();
- nFlags &= ~F_SELRECT_VISIBLE;
- }
-}
-
-void SvImpIconView::ImpDrawXORRect( const Rectangle& rRect )
-{
- RasterOp eOldOp = pView->GetRasterOp();
- pView->SetRasterOp( ROP_XOR );
- Color aOldColor = pView->GetFillColor();
- pView->SetFillColor();
- pView->DrawRect( rRect );
- pView->SetFillColor( aOldColor );
- pView->SetRasterOp( eOldOp );
-}
-
-void SvImpIconView::CalcScrollOffsets( const Point& rPosPixel,
- long& rX, long& rY, sal_Bool bInDragDrop, sal_uInt16 nBorderWidth)
-{
- // Scrolling der View, falls sich der Mauszeiger im Grenzbereich des
- // Fensters befindet
- long nPixelToScrollX = 0;
- long nPixelToScrollY = 0;
- Size aWndSize = aOutputSize;
-
- nBorderWidth = (sal_uInt16)(Min( (long)(aWndSize.Height()-1), (long)nBorderWidth ));
- nBorderWidth = (sal_uInt16)(Min( (long)(aWndSize.Width()-1), (long)nBorderWidth ));
-
- if ( rPosPixel.X() < nBorderWidth )
- {
- if( bInDragDrop )
- nPixelToScrollX = -DD_SCROLL_PIXEL;
- else
- nPixelToScrollX = rPosPixel.X()- nBorderWidth;
- }
- else if ( rPosPixel.X() > aWndSize.Width() - nBorderWidth )
- {
- if( bInDragDrop )
- nPixelToScrollX = DD_SCROLL_PIXEL;
- else
- nPixelToScrollX = rPosPixel.X() - (aWndSize.Width() - nBorderWidth);
- }
- if ( rPosPixel.Y() < nBorderWidth )
- {
- if( bInDragDrop )
- nPixelToScrollY = -DD_SCROLL_PIXEL;
- else
- nPixelToScrollY = rPosPixel.Y() - nBorderWidth;
- }
- else if ( rPosPixel.Y() > aWndSize.Height() - nBorderWidth )
- {
- if( bInDragDrop )
- nPixelToScrollY = DD_SCROLL_PIXEL;
- else
- nPixelToScrollY = rPosPixel.Y() - (aWndSize.Height() - nBorderWidth);
- }
-
- rX = nPixelToScrollX;
- rY = nPixelToScrollY;
-}
-
-IMPL_LINK(SvImpIconView, MouseMoveTimeoutHdl, Timer*, pTimer )
-{
- pTimer->Start();
- MouseMove( aMouseMoveEvent );
- return 0;
-}
-
-void SvImpIconView::EndTracking()
-{
- pView->ReleaseMouse();
- if( nFlags & F_RUBBERING )
- {
- aMouseMoveTimer.Stop();
- nFlags &= ~(F_RUBBERING | F_ADD_MODE);
- }
-}
-
-sal_Bool SvImpIconView::IsTextHit( SvLBoxEntry* pEntry, const Point& rDocPos )
-{
- SvLBoxString* pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
- if( pItem )
- {
- Rectangle aRect( CalcTextRect( pEntry, pItem ));
- if( aRect.IsInside( rDocPos ) )
- return sal_True;
- }
- return sal_False;
-}
-
-IMPL_LINK(SvImpIconView, EditTimeoutHdl, Timer*, EMPTYARG )
-{
- SvLBoxEntry* pEntry = GetCurEntry();
- if( pView->IsInplaceEditingEnabled() && pEntry &&
- pView->IsSelected( pEntry ))
- {
- pView->EditEntry( pEntry );
- }
- return 0;
-}
-
-
-//
-// Funktionen zum Ausrichten der Eintraege am Grid
-//
-
-// pStart == 0: Alle Eintraege werden ausgerichtet
-// sonst: Alle Eintraege der Zeile ab einschliesslich pStart werden ausgerichtet
-void SvImpIconView::AdjustAtGrid( SvLBoxEntry* pStart )
-{
- SvPtrarr aLists;
- pImpCursor->CreateGridAjustData( aLists, pStart );
- sal_uInt16 nCount = aLists.Count();
- for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ )
- {
- AdjustAtGrid( *(SvPtrarr*)aLists[ nCur ], pStart );
- }
- ImpIcnCursor::DestroyGridAdjustData( aLists );
- CheckScrollBars();
-}
-
-// Richtet eine Zeile aus, erweitert ggf. die Breite; Bricht die Zeile nicht um
-void SvImpIconView::AdjustAtGrid( const SvPtrarr& rRow, SvLBoxEntry* pStart )
-{
- if( !rRow.Count() )
- return;
-
- sal_Bool bGo;
- if( !pStart )
- bGo = sal_True;
- else
- bGo = sal_False;
-
- long nCurRight = 0;
- for( sal_uInt16 nCur = 0; nCur < rRow.Count(); nCur++ )
- {
- SvLBoxEntry* pCur = (SvLBoxEntry*)rRow[ nCur ];
- if( !bGo && pCur == pStart )
- bGo = sal_True;
-
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pCur);
- // Massgebend (fuer das menschliche Auge) ist die Bitmap, da sonst
- // durch lange Texte der Eintrag stark springen kann
- const Rectangle& rBoundRect = GetBoundingRect( pCur, pViewData );
- Rectangle aCenterRect( CalcBmpRect( pCur, 0, pViewData ));
- if( bGo && !pViewData->IsEntryPosLocked() )
- {
- long nWidth = aCenterRect.GetSize().Width();
- Point aNewPos( AdjustAtGrid( aCenterRect, rBoundRect ) );
- while( aNewPos.X() < nCurRight )
- aNewPos.X() += nGridDX;
- if( aNewPos != rBoundRect.TopLeft() )
- SetEntryPosition( pCur, aNewPos );
- nCurRight = aNewPos.X() + nWidth;
- }
- else
- {
- nCurRight = rBoundRect.Right();
- }
- }
-}
-
-// Richtet Rect am Grid aus, garantiert jedoch nicht, dass die
-// neue Pos. frei ist. Die Pos. kann fuer SetEntryPos verwendet werden.
-// Das CenterRect beschreibt den Teil des BoundRects, der fuer
-// die Berechnung des Ziel-Rechtecks verwendet wird.
-Point SvImpIconView::AdjustAtGrid( const Rectangle& rCenterRect,
- const Rectangle& rBoundRect ) const
-{
- Point aPos( rCenterRect.TopLeft() );
- Size aSize( rCenterRect.GetSize() );
-
- aPos.X() -= LROFFS_WINBORDER;
- aPos.Y() -= TBOFFS_WINBORDER;
-
- // align (ref ist mitte des rects)
- short nGridX = (short)((aPos.X()+(aSize.Width()/2)) / nGridDX);
- short nGridY = (short)((aPos.Y()+(aSize.Height()/2)) / nGridDY);
- aPos.X() = nGridX * nGridDX;
- aPos.Y() = nGridY * nGridDY;
- // hor. center
- aPos.X() += (nGridDX - rBoundRect.GetSize().Width() ) / 2;
-
- aPos.X() += LROFFS_WINBORDER;
- aPos.Y() += TBOFFS_WINBORDER;
-
- return aPos;
-}
-
-
-void SvImpIconView::SetTextMode( SvIconViewTextMode eMode, SvLBoxEntry* pEntry )
-{
- if( !pEntry )
- {
- if( eTextMode != eMode )
- {
- if( eTextMode == ShowTextDontKnow )
- eTextMode = ShowTextShort;
- eTextMode = eMode;
- pView->Arrange();
- }
- }
- else
- {
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
- if( pViewData->eTextMode != eMode )
- {
- pViewData->eTextMode = eMode;
- pModel->InvalidateEntry( pEntry );
- AdjustVirtSize( pViewData->aRect );
- }
- }
-}
-
-SvIconViewTextMode SvImpIconView::GetTextMode( const SvLBoxEntry* pEntry,
- const SvIcnVwDataEntry* pViewData ) const
-{
- if( !pEntry )
- return eTextMode;
- else
- {
- if( !pViewData )
- pViewData = ICNVIEWDATA(((SvLBoxEntry*)pEntry));
- return pViewData->GetTextMode();
- }
-}
-
-SvIconViewTextMode SvImpIconView::GetEntryTextModeSmart( const SvLBoxEntry* pEntry,
- const SvIcnVwDataEntry* pViewData ) const
-{
- DBG_ASSERT(pEntry,"GetEntryTextModeSmart: Entry not set");
- if( !pViewData )
- pViewData = ICNVIEWDATA(((SvLBoxEntry*)pEntry));
- SvIconViewTextMode eMode = pViewData->GetTextMode();
- if( eMode == ShowTextDontKnow )
- return eTextMode;
- return eMode;
-}
-
-void SvImpIconView::ShowFocusRect( const SvLBoxEntry* pEntry )
-{
- if( !pEntry )
- pView->HideFocus();
- else
- {
- Rectangle aRect ( CalcFocusRect( (SvLBoxEntry*)pEntry ) );
- pView->ShowFocus( aRect );
- }
-}
-
-IMPL_LINK(SvImpIconView, UserEventHdl, void*, EMPTYARG )
-{
- nCurUserEvent = 0;
- AdjustScrollBars();
- Rectangle aRect;
- if( GetResizeRect(aRect) )
- PaintResizeRect( aRect );
- return 0;
-}
-
-void SvImpIconView::CancelUserEvent()
-{
- if( nCurUserEvent )
- {
- Application::RemoveUserEvent( nCurUserEvent );
- nCurUserEvent = 0;
- }
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx
index d03b956bf571..7695137431f0 100644
--- a/svtools/source/contnr/svtreebx.cxx
+++ b/svtools/source/contnr/svtreebx.cxx
@@ -853,6 +853,11 @@ void SvTreeListBox::ScrollOutputArea( short nDeltaEntries )
NotifyEndScroll();
}
+void SvTreeListBox::ScrollToAbsPos( long nPos )
+{
+ pImp->ScrollToAbsPos( nPos );
+}
+
void SvTreeListBox::SetSelectionMode( SelectionMode eSelectMode )
{
DBG_CHKTHIS(SvTreeListBox,0);
@@ -2447,6 +2452,28 @@ SvLBoxEntry* SvTreeListBox::GetNextEntryInView(SvLBoxEntry* pEntry ) const
return pNext;
}
+SvLBoxEntry* SvTreeListBox::GetLastEntryInView() const
+{
+ SvLBoxEntry* pEntry = GetFirstEntryInView();
+ SvLBoxEntry* pNext = 0;
+ while( pEntry )
+ {
+ pNext = (SvLBoxEntry*)NextVisible( pEntry );
+ if( pNext )
+ {
+ Point aPos( GetEntryPosition(pNext) );
+ const Size& rSize = pImp->GetOutputSize();
+ if( aPos.Y() < 0 || aPos.Y() >= rSize.Height() )
+ break;
+ else
+ pEntry = pNext;
+ }
+ else
+ break;
+ }
+ return pEntry;
+}
+
void SvTreeListBox::ShowFocusRect( const SvLBoxEntry* pEntry )
{
pImp->ShowFocusRect( pEntry );
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index 14dae85f4ee8..e185705806be 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -180,10 +180,10 @@ sal_uInt16 ColorListBox::InsertEntry( const Color& rColor, const XubString& rStr
// -----------------------------------------------------------------------
-void ColorListBox::InsertAutomaticEntry()
+void ColorListBox::InsertAutomaticEntryColor(const Color &rColor)
{
// insert the "Automatic"-entry always on the first position
- InsertEntry( Color( COL_AUTO ), SvtResId( STR_SVT_AUTOMATIC_COLOR ), 0 );
+ InsertEntry( rColor, SvtResId( STR_SVT_AUTOMATIC_COLOR ), 0 );
}
// -----------------------------------------------------------------------
diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx
index bc0ee75a845b..49309fd4f001 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -1978,29 +1978,6 @@ void TabBar::Clear()
// -----------------------------------------------------------------------
-void TabBar::EnablePage( sal_uInt16 nPageId, sal_Bool bEnable )
-{
- sal_uInt16 nPos = GetPagePos( nPageId );
-
- if ( nPos != PAGE_NOT_FOUND )
- {
- ImplTabBarItem* pItem = (*mpItemList)[ nPos ];
-
- if ( pItem->mbEnable != bEnable )
- {
- pItem->mbEnable = bEnable;
-
- // Leiste neu ausgeben
- if ( IsReallyVisible() && IsUpdateMode() )
- Invalidate( pItem->maRect );
-
- CallEventListeners( bEnable ? VCLEVENT_TABBAR_PAGEENABLED : VCLEVENT_TABBAR_PAGEDISABLED, reinterpret_cast<void*>(sal::static_int_cast<sal_IntPtr>(nPageId)) );
- }
- }
-}
-
-// -----------------------------------------------------------------------
-
sal_Bool TabBar::IsPageEnabled( sal_uInt16 nPageId ) const
{
sal_uInt16 nPos = GetPagePos( nPageId );
@@ -2302,48 +2279,6 @@ void TabBar::SelectPage( sal_uInt16 nPageId, sal_Bool bSelect )
// -----------------------------------------------------------------------
-void TabBar::SelectPageRange( sal_Bool bSelect, sal_uInt16 nStartPos, sal_uInt16 nEndPos )
-{
- Rectangle aPaintRect;
- sal_uInt16 nPos = nStartPos;
- ImplTabBarItem* pItem = seek( nPos );
- while ( pItem && (nPos <= nEndPos) )
- {
- if ( (pItem->mbSelect != bSelect) && (pItem->mnId != mnCurPageId) )
- {
- pItem->mbSelect = bSelect;
- aPaintRect.Union( pItem->maRect );
- }
-
- nPos++;
- pItem = next();
- }
-
- // Leiste neu ausgeben
- if ( IsReallyVisible() && IsUpdateMode() && !aPaintRect.IsEmpty() )
- Invalidate( aPaintRect );
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 TabBar::GetSelectPage( sal_uInt16 nSelIndex ) const
-{
- sal_uInt16 nSelected = 0;
- for ( size_t i = 0, n = mpItemList->size(); i < n; ++i )
- {
- ImplTabBarItem* pItem = (*mpItemList)[ i ];
- if ( pItem->mbSelect )
- nSelected++;
-
- if ( nSelected == nSelIndex )
- return pItem->mnId;
- }
-
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
sal_uInt16 TabBar::GetSelectPageCount() const
{
sal_uInt16 nSelected = 0;
@@ -2519,78 +2454,6 @@ void TabBar::SetMaxPageWidth( long nMaxWidth )
// -----------------------------------------------------------------------
-void TabBar::SetSelectColor()
-{
- if ( mbSelColor )
- {
- maSelColor = Color( COL_TRANSPARENT );
- mbSelColor = sal_False;
- Invalidate();
- }
-}
-
-// -----------------------------------------------------------------------
-
-void TabBar::SetSelectColor( const Color& rColor )
-{
- if ( rColor.GetTransparency() )
- {
- if ( mbSelColor )
- {
- maSelColor = Color( COL_TRANSPARENT );
- mbSelColor = sal_False;
- Invalidate();
- }
- }
- else
- {
- if ( maSelColor != rColor )
- {
- maSelColor = rColor;
- mbSelColor = sal_True;
- Invalidate();
- }
- }
-}
-
-// -----------------------------------------------------------------------
-
-void TabBar::SetSelectTextColor()
-{
- if ( mbSelTextColor )
- {
- maSelTextColor = Color( COL_TRANSPARENT );
- mbSelTextColor = sal_False;
- Invalidate();
- }
-}
-
-// -----------------------------------------------------------------------
-
-void TabBar::SetSelectTextColor( const Color& rColor )
-{
- if ( rColor.GetTransparency() )
- {
- if ( mbSelTextColor )
- {
- maSelTextColor = Color( COL_TRANSPARENT );
- mbSelTextColor = sal_False;
- Invalidate();
- }
- }
- else
- {
- if ( maSelTextColor != rColor )
- {
- maSelTextColor = rColor;
- mbSelTextColor = sal_True;
- Invalidate();
- }
- }
-}
-
-// -----------------------------------------------------------------------
-
void TabBar::SetPageText( sal_uInt16 nPageId, const XubString& rText )
{
sal_uInt16 nPos = GetPagePos( nPageId );
@@ -2620,15 +2483,6 @@ XubString TabBar::GetPageText( sal_uInt16 nPageId ) const
// -----------------------------------------------------------------------
-void TabBar::SetHelpText( sal_uInt16 nPageId, const XubString& rText )
-{
- sal_uInt16 nPos = GetPagePos( nPageId );
- if ( nPos != PAGE_NOT_FOUND )
- (*mpItemList)[ nPos ]->maHelpText = rText;
-}
-
-// -----------------------------------------------------------------------
-
XubString TabBar::GetHelpText( sal_uInt16 nPageId ) const
{
sal_uInt16 nPos = GetPagePos( nPageId );
@@ -2650,15 +2504,6 @@ XubString TabBar::GetHelpText( sal_uInt16 nPageId ) const
// -----------------------------------------------------------------------
-void TabBar::SetHelpId( sal_uInt16 nPageId, const rtl::OString& rHelpId )
-{
- sal_uInt16 nPos = GetPagePos( nPageId );
- if ( nPos != PAGE_NOT_FOUND )
- (*mpItemList)[ nPos ]->maHelpId = rHelpId;
-}
-
-// -----------------------------------------------------------------------
-
rtl::OString TabBar::GetHelpId( sal_uInt16 nPageId ) const
{
sal_uInt16 nPos = GetPagePos( nPageId );
@@ -2670,18 +2515,6 @@ rtl::OString TabBar::GetHelpId( sal_uInt16 nPageId ) const
// -----------------------------------------------------------------------
-long TabBar::GetMinSize() const
-{
- long nMinSize = TABBAR_MINSIZE + TABBAR_OFFSET_X;
- if ( mnWinStyle & WB_MINSCROLL )
- nMinSize += mpPrevBtn->GetSizePixel().Width()*2;
- else if ( mnWinStyle & WB_SCROLL )
- nMinSize += mpFirstBtn->GetSizePixel().Width()*4;
- return nMinSize;
-}
-
-// -----------------------------------------------------------------------
-
sal_Bool TabBar::StartDrag( const CommandEvent& rCEvt, Region& rRegion )
{
if ( !(mnWinStyle & WB_DRAG) || (rCEvt.GetCommand() != COMMAND_STARTDRAG) )
diff --git a/svtools/source/control/taskbar.cxx b/svtools/source/control/taskbar.cxx
index 8d3a6abce18f..a41730c3318b 100644
--- a/svtools/source/control/taskbar.cxx
+++ b/svtools/source/control/taskbar.cxx
@@ -464,70 +464,6 @@ void TaskBar::Format()
// -----------------------------------------------------------------------
-void TaskBar::SetLines( sal_uInt16 nLines )
-{
- mnLines = nLines;
-}
-
-// -----------------------------------------------------------------------
-
-void TaskBar::EnableAutoHide( sal_Bool bAutoHide )
-{
- mbAutoHide = bAutoHide;
-
- if ( mbAutoHide )
- {
- ImplNewHeight( TASKBAR_AUTOHIDE_HEIGHT );
- }
- else
- {
- ImplNewHeight( CalcWindowSizePixel().Height() );
- }
-}
-
-// -----------------------------------------------------------------------
-
-void TaskBar::ShowStatusText( const String& rText )
-{
- if ( mpStatusBar )
- {
- if ( !mbStatusText )
- {
- mbStatusText = sal_True;
- if ( mpStatusBar->AreItemsVisible() )
- {
- mbShowItems = sal_True;
- mpStatusBar->HideItems();
- }
- else
- mbShowItems = sal_True;
- maOldText = mpStatusBar->GetText();
- Resize();
- mpStatusBar->SetText( rText );
- Update();
- mpStatusBar->Update();
- }
- else
- mpStatusBar->SetText( rText );
- }
-}
-
-// -----------------------------------------------------------------------
-
-void TaskBar::HideStatusText()
-{
- if ( mbStatusText && mpStatusBar )
- {
- mbStatusText = sal_False;
- mpStatusBar->SetText( maOldText );
- Resize();
- if ( mbShowItems )
- mpStatusBar->ShowItems();
- }
-}
-
-// -----------------------------------------------------------------------
-
Size TaskBar::CalcWindowSizePixel() const
{
TaskButtonBar* pTempButtonBar = GetButtonBar();
diff --git a/svtools/source/control/taskmisc.cxx b/svtools/source/control/taskmisc.cxx
index 1476cacb76fb..246d107fc1d1 100644
--- a/svtools/source/control/taskmisc.cxx
+++ b/svtools/source/control/taskmisc.cxx
@@ -61,14 +61,13 @@ void TaskButtonBar::RequestHelp( const HelpEvent& rHEvt )
WindowArrange::WindowArrange()
{
- mpWinList = new List;
}
// -----------------------------------------------------------------------
WindowArrange::~WindowArrange()
{
- delete mpWinList;
+ maWinList.clear();
}
// -----------------------------------------------------------------------
@@ -103,22 +102,21 @@ static void ImplPosSizeWindow( Window* pWindow,
void WindowArrange::ImplTile( const Rectangle& rRect )
{
- sal_uInt16 nCount = (sal_uInt16)mpWinList->Count();
+ size_t nCount = maWinList.size();
if ( nCount < 3 )
{
ImplVert( rRect );
return;
}
- sal_uInt16 i;
- sal_uInt16 j;
- sal_uInt16 nCols;
- sal_uInt16 nRows;
- sal_uInt16 nActRows;
- sal_uInt16 nOffset;
+ sal_uInt16 i;
+ sal_uInt16 j;
+ sal_uInt16 nCols;
+ sal_uInt16 nRows;
+ sal_uInt16 nActRows;
+ sal_uInt16 nOffset;
long nOverWidth;
long nOverHeight;
- Window* pWindow;
long nX = rRect.Left();
long nY = rRect.Top();
long nWidth = rRect.GetWidth();
@@ -144,7 +142,7 @@ void WindowArrange::ImplTile( const Rectangle& rRect )
nWidth = 1;
nOverWidth = nRectWidth-(nWidth*nCols);
- pWindow = (Window*)mpWinList->First();
+ WindowList_impl::iterator it = maWinList.begin();
for ( i = 0; i < nCols; i++ )
{
if ( i < nOffset )
@@ -172,18 +170,17 @@ void WindowArrange::ImplTile( const Rectangle& rRect )
nTempHeight++;
nOverHeight--;
}
- ImplPosSizeWindow( pWindow, nX, nY, nTempWidth, nTempHeight );
+ ImplPosSizeWindow( *it, nX, nY, nTempWidth, nTempHeight );
nY += nTempHeight;
- pWindow = (Window*)mpWinList->Next();
- if ( !pWindow )
+ if ( ++it == maWinList.end() )
break;
}
nX += nWidth;
nY = nRectY;
- if ( !pWindow )
+ if ( it == maWinList.end() )
break;
}
}
@@ -192,7 +189,7 @@ void WindowArrange::ImplTile( const Rectangle& rRect )
void WindowArrange::ImplHorz( const Rectangle& rRect )
{
- long nCount = (long)mpWinList->Count();
+ size_t nCount = maWinList.size();
long nX = rRect.Left();
long nY = rRect.Top();
long nWidth = rRect.GetWidth();
@@ -206,9 +203,9 @@ void WindowArrange::ImplHorz( const Rectangle& rRect )
if ( nHeight < 1 )
nHeight = 1;
nOver = nRectHeight - (nCount*nHeight);
- pWindow = (Window*)mpWinList->First();
- while ( pWindow )
+ for( size_t index = 0; index < nCount; ++index )
{
+ pWindow = maWinList[ index ];
nTempHeight = nHeight;
if ( nOver > 0 )
{
@@ -217,8 +214,6 @@ void WindowArrange::ImplHorz( const Rectangle& rRect )
}
ImplPosSizeWindow( pWindow, nX, nY, nWidth, nTempHeight );
nY += nTempHeight;
-
- pWindow = (Window*)mpWinList->Next();
}
}
@@ -226,7 +221,7 @@ void WindowArrange::ImplHorz( const Rectangle& rRect )
void WindowArrange::ImplVert( const Rectangle& rRect )
{
- long nCount = (long)mpWinList->Count();
+ size_t nCount = maWinList.size();
long nX = rRect.Left();
long nY = rRect.Top();
long nWidth = rRect.GetWidth();
@@ -240,9 +235,9 @@ void WindowArrange::ImplVert( const Rectangle& rRect )
if ( nWidth < 1 )
nWidth = 1;
nOver = nRectWidth - (nCount*nWidth);
- pWindow = (Window*)mpWinList->First();
- while ( pWindow )
+ for( size_t index = 0; index < nCount; ++index )
{
+ pWindow = maWinList[ index ];
nTempWidth = nWidth;
if ( nOver > 0 )
{
@@ -251,8 +246,6 @@ void WindowArrange::ImplVert( const Rectangle& rRect )
}
ImplPosSizeWindow( pWindow, nX, nY, nTempWidth, nHeight );
nX += nTempWidth;
-
- pWindow = (Window*)mpWinList->Next();
}
}
@@ -285,7 +278,7 @@ void WindowArrange::ImplCascade( const Rectangle& rRect )
Window* pTempWindow;
// Border-Fenster suchen um den Versatz zu ermitteln
- pTempWindow = (Window*)mpWinList->First();
+ pTempWindow = maWinList.front();
pTempWindow->GetBorder( nLeftBorder, nTopBorder, nRightBorder, nBottomBorder );
while ( !nTopBorder )
{
@@ -313,9 +306,9 @@ void WindowArrange::ImplCascade( const Rectangle& rRect )
nStartOverHeight = nRectHeight-(nHeight+(nCascadeWins*nOff));
i = 0;
- pWindow = (Window*)mpWinList->First();
- while ( pWindow )
+ for( size_t index = 0, count = maWinList.size(); index < count; ++index )
{
+ pWindow = maWinList[ index ];
if ( !i )
{
nOverWidth = nStartOverWidth;
@@ -346,8 +339,6 @@ void WindowArrange::ImplCascade( const Rectangle& rRect )
i++;
else
i = 0;
-
- pWindow = (Window*)mpWinList->Next();
}
}
@@ -355,7 +346,7 @@ void WindowArrange::ImplCascade( const Rectangle& rRect )
void WindowArrange::Arrange( sal_uInt16 nType, const Rectangle& rRect )
{
- if ( !mpWinList->Count() )
+ if ( maWinList.empty() )
return;
switch ( nType )
diff --git a/svtools/source/control/taskstat.cxx b/svtools/source/control/taskstat.cxx
index b94aae25a88f..08f2a25b4b2f 100644
--- a/svtools/source/control/taskstat.cxx
+++ b/svtools/source/control/taskstat.cxx
@@ -110,21 +110,6 @@ TaskStatusFieldItem::TaskStatusFieldItem( const TaskStatusFieldItem& rItem ) :
// -----------------------------------------------------------------------
-TaskStatusFieldItem::TaskStatusFieldItem( ITaskStatusNotify* pNotify,
- const Image& rImage,
- const XubString& rQuickHelpText,
- const XubString& rHelpText,
- sal_uInt16 nFlags ) :
- mpNotify( pNotify ),
- maImage( rImage ),
- maQuickHelpText( rQuickHelpText ),
- maHelpText( rHelpText ),
- mnFlags( nFlags )
-{
-}
-
-// -----------------------------------------------------------------------
-
TaskStatusFieldItem::~TaskStatusFieldItem()
{
}
@@ -563,90 +548,4 @@ void TaskStatusBar::InsertStatusField( long, sal_uInt16,
ImplUpdateField( sal_False );
}
-// -----------------------------------------------------------------------
-
-void TaskStatusBar::SetFieldFlags( sal_uInt16 nFlags )
-{
- if ( mnFieldFlags != nFlags )
- {
- mnFieldFlags = nFlags;
- ImplUpdateField( sal_False );
- }
-}
-
-// -----------------------------------------------------------------------
-
-void TaskStatusBar::AddStatusFieldItem( sal_uInt16 nItemId, const TaskStatusFieldItem& rItem,
- sal_uInt16 nPos )
-{
- DBG_ASSERT( nItemId, "TaskStatusBar::AddStatusFieldItem() - Item is 0" );
- DBG_ASSERT( !ImplGetFieldItem( nItemId ), "TaskStatusBar::AddStatusFieldItem() - Item-Id already exist" );
-
- if ( !mpFieldItemList )
- mpFieldItemList = new ImplTaskSBItemList;
-
- ImplTaskSBFldItem* pItem = new ImplTaskSBFldItem;
- pItem->maItem = rItem;
- pItem->mnId = nItemId;
- pItem->mnOffX = 0;
- if ( nPos < mpFieldItemList->size() ) {
- ImplTaskSBItemList::iterator it = mpFieldItemList->begin();
- ::std::advance( it, nPos );
- mpFieldItemList->insert( it, pItem );
- } else {
- mpFieldItemList->push_back( pItem );
- }
-
- ImplUpdateField( sal_True );
-}
-
-// -----------------------------------------------------------------------
-
-void TaskStatusBar::ModifyStatusFieldItem( sal_uInt16 nItemId, const TaskStatusFieldItem& rItem )
-{
- ImplTaskSBFldItem* pItem = ImplGetFieldItem( nItemId );
- if ( pItem )
- {
- sal_Bool bUpdate = (pItem->maItem.GetImage() != rItem.GetImage()) ||
- (pItem->maItem.GetFlags() != rItem.GetFlags());
- pItem->maItem = rItem;
- if ( bUpdate )
- ImplUpdateField( sal_True );
- }
-}
-
-// -----------------------------------------------------------------------
-
-void TaskStatusBar::RemoveStatusFieldItem( sal_uInt16 nItemId )
-{
- ImplTaskSBFldItem* pItem = ImplGetFieldItem( nItemId );
- if ( pItem )
- {
- for ( ImplTaskSBItemList::iterator it = mpFieldItemList->begin();
- it < mpFieldItemList->end();
- ++it
- ) {
- if ( *it == pItem ) {
- delete *it;
- mpFieldItemList->erase( it );
- break;
- }
- }
- }
-}
-
-// -----------------------------------------------------------------------
-
-sal_Bool TaskStatusBar::GetStatusFieldItem( sal_uInt16 nItemId, TaskStatusFieldItem& rItem ) const
-{
- ImplTaskSBFldItem* pItem = ImplGetFieldItem( nItemId );
- if ( pItem )
- {
- rItem = pItem->maItem;
- return sal_True;
- }
-
- return sal_False;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/dialogs/mcvmath.cxx b/svtools/source/dialogs/mcvmath.cxx
index 5d5ad14c82c2..f34737b8a4f0 100644
--- a/svtools/source/dialogs/mcvmath.cxx
+++ b/svtools/source/dialogs/mcvmath.cxx
@@ -71,23 +71,6 @@ Fix ImpMultBig2( const Fix& a, const Fix& b )
/**************************************************************************
|*
-|* ImpMultBig2()
-|*
-|* Beschreibung Multiplikation fuer FixPoint-Berechnungen
-|*
-**************************************************************************/
-
-// first parameter should be the bigger one
-
-FixCpx ImpMultBig2( const FixCpx& ra, const FixCpx& rb )
-{
- Fix rr = ImpMultBig2(ra.r,rb.r)-ImpMultBig2(ra.i,rb.i);
- Fix ii = ImpMultBig2(ra.r,rb.i)+ImpMultBig2(ra.i,rb.r);
- return FixCpx( rr,ii );
-}
-
-/**************************************************************************
-|*
|* ImpSqrt()
|*
|* Beschreibung Wurzelfunktion fuer FixPoint-Berechnungen
@@ -146,146 +129,4 @@ FixCpx ImpExPI( sal_uInt16 nPhi )
return aIter;
}
-/**************************************************************************
-|*
-|* ImpATanx2()
-|*
-|* Beschreibung ATANX2-Funktion fuer FixPoint-Berechnungen
-|*
-**************************************************************************/
-
-// use for x*x+y*y==1 only
-
-static sal_uInt16 ImpATanx2( const Fix& rX, const Fix& rY )
-{
- sal_uInt16 phi0 = 0; // result angel higher part
- sal_uInt16 phi = 0; // dito lower part
- long x = rX.x;
- long y = rY.x;
- long z;
- const char Sft=14-FIX_POST;
- short i;
- FixCpx aTry;
- FixCpx aInc;
- FixCpx aIter(1L);
- sal_Bool Small = sal_False;
-
- if ( (x==0) && (y==0) )
- return 0;
-
- if ( y < 0)
- {
- // reduce 3. to 1. quadrant (0..90 Degree)
- phi0 += 180L * 65536L / 360L;
- // turn 180 degree
- y *= -1;
- x *= -1;
- }
-
- if ( x < 0)
- {
- // 2. to 1. q.
- phi0 += 90L * 65536L / 360L;
- // turn 90 degree clockwise
- z = y;
- y = -x;
- x = z;
- }
-
- for ( i = 13; i >= 0; i-- )
- {
- aInc.r.x = CosTab[i]>>Sft; // e**(i(phi1+phi2)) =
- aInc.i.x = SinTab[i]>>Sft; // e**(i*phi1)) * e**(i*phi2))
- aTry = aIter*aInc;
-
- if ( Small )
- {
- // is try ok
- if ( aTry.r.x >= x )
- {
- aIter = aTry;
- phi += (1<<i);
- }
- }
- else
- {
- // is try ok
- if ( aTry.i.x <= y )
- {
- aIter = aTry;
- phi += (1<<i);
-
- if ( i > 11 )
- Small=sal_True;
- }
- }
- }
-
- return phi0+phi;
-}
-
-/**************************************************************************
-|*
-|* ImpATan2()
-|*
-|* Beschreibung ATAN-Funktion fuer FixPoint-Berechnungen
-|*
-**************************************************************************/
-
-sal_uInt16 ImpATan2( const short x, const short y )
-{
- Fix rRad = ImpSqrt(sal_uLong(long(x)*x+long(y)*y));
-
- if ( !rRad.x )
- return 0;
- Fix fx = x;
- fx.DivBig( rRad ); // Normiere auf Einheitskreis
- Fix fy = y;
- fy.DivBig( rRad );
-
- return ImpATanx2( fx, fy );
-}
-
-/**************************************************************************
-|*
-|* ImpCartToPolar()
-|*
-|* Beschreibung Koordinaaten-Wandlung
-|*
-**************************************************************************/
-
-void ImpCartToPolar( const short x, const short y, Fix& rRad, sal_uInt16& rPhi )
-{
- rRad = Fix( ImpSqrt( sal_uLong( long(x)*x+long(y)*y ) ) );
-
- if ( !rRad.x )
- rPhi=0;
- else
- {
- // Normiere auf Einheitskreis
- Fix fx = x;
- fx.DivBig(rRad);
- Fix fy = y;
- fy.DivBig(rRad);
- rPhi = ImpATanx2(fx, fy);
- }
-}
-
-/**************************************************************************
-|*
-|* ImpPolarToCart()
-|*
-|* Beschreibung Koordinaaten-Wandlung
-|*
-**************************************************************************/
-
-void ImpPolarToCart( const Fix& rR, const sal_uInt16 Phi, short& rX, short& rY )
-{
- FixCpx fc = ImpExPI( Phi ); // calculate sin() & cos()
- fc.GetReal().MultBig( rR );
- rX = sal::static_int_cast< short >(long( fc.GetReal() ));
- fc.GetImag().MultBig( rR );
- rY = sal::static_int_cast< short >(long( fc.GetImag() ));
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/dialogs/mcvmath.hxx b/svtools/source/dialogs/mcvmath.hxx
index 5e0d47e655ef..c3e2005352ab 100644
--- a/svtools/source/dialogs/mcvmath.hxx
+++ b/svtools/source/dialogs/mcvmath.hxx
@@ -75,8 +75,6 @@ private:
friend class FixCpx;
friend class ColWheel;
-// friend Fix ImpMultBig2( const Fix& a, const Fix& b );
-
public:
long x;
@@ -122,8 +120,6 @@ public:
class FixCpx
{
-// friend FixCpx ImpMultBig2( const FixCpx& ra, const FixCpx& rb );
-
public:
Fix r;
Fix i;
@@ -217,13 +213,8 @@ inline FixCpx operator/ ( const FixCpx& a, const FixCpx& b )
// -----------------------------------------------------------------------
Fix ImpMultBig2( const Fix& a, const Fix& b );
-FixCpx ImpMultBig2( const FixCpx& ra, const FixCpx& rb );
-
-void ImpCartToPolar( const short x, const short y, Fix& rRad, sal_uInt16& rPhi );
-void ImpPolarToCart( const Fix& rR, const sal_uInt16 Phi, short& rX, short& rY );
sal_uInt16 ImpSqrt( sal_uLong nRadi );
-sal_uInt16 ImpATan2( const short x, const short y );
FixCpx ImpExPI( sal_uInt16 nPhi );
#endif // _MCVMATH_HXX
diff --git a/svtools/source/dialogs/prnsetup.cxx b/svtools/source/dialogs/prnsetup.cxx
index 728d0e6ea5c7..1c39b8e6f70d 100644
--- a/svtools/source/dialogs/prnsetup.cxx
+++ b/svtools/source/dialogs/prnsetup.cxx
@@ -281,11 +281,6 @@ void PrinterSetupDialog::SetOptionsHdl( const Link& rLink )
maBtnOptions.Show( rLink.IsSet() );
}
-const Link& PrinterSetupDialog::GetOptionsHdl() const
-{
- return maBtnOptions.GetClickHdl();
-}
-
void PrinterSetupDialog::ImplSetInfo()
{
const QueueInfo* pInfo = Printer::GetQueueInfo(maLbName.GetSelectEntry(), true);
diff --git a/svtools/source/edit/syntaxhighlight.cxx b/svtools/source/edit/syntaxhighlight.cxx
index f859e9930cf9..df9c9d1acea9 100644
--- a/svtools/source/edit/syntaxhighlight.cxx
+++ b/svtools/source/edit/syntaxhighlight.cxx
@@ -237,6 +237,8 @@ extern "C" int CDECL compare_strings( const void *arg1, const void *arg2 )
}
+namespace {
+
class LetterTable
{
bool IsLetterTab[256];
@@ -252,6 +254,8 @@ public:
bool isLetterUnicode( sal_Unicode c );
};
+}
+
class BasicSimpleCharClass
{
static LetterTable aLetterTable;
@@ -671,41 +675,6 @@ sal_Bool SimpleTokenizer_Impl::getNextToken( /*out*/TokenTypes& reType,
return sal_True;
}
-String SimpleTokenizer_Impl::getTokStr
- ( /*out*/const sal_Unicode* pStartPos, /*out*/const sal_Unicode* pEndPos )
-{
- return String( pStartPos, (sal_uInt16)( pEndPos - pStartPos ) );
-}
-
-#ifdef DBG_UTIL
-// TEST: Token ausgeben
-String SimpleTokenizer_Impl::getFullTokenStr( /*out*/TokenTypes eType,
- /*out*/const sal_Unicode* pStartPos, /*out*/const sal_Unicode* pEndPos )
-{
- String aOut;
- switch( eType )
- {
- case TT_UNKNOWN: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_UNKNOWN:") ); break;
- case TT_IDENTIFIER: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_IDENTIFIER:") ); break;
- case TT_WHITESPACE: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_WHITESPACE:") ); break;
- case TT_NUMBER: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_NUMBER:") ); break;
- case TT_STRING: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_STRING:") ); break;
- case TT_EOL: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_EOL:") ); break;
- case TT_COMMENT: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_COMMENT:") ); break;
- case TT_ERROR: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_ERROR:") ); break;
- case TT_OPERATOR: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_OPERATOR:") ); break;
- case TT_KEYWORDS: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_KEYWORD:") ); break;
- case TT_PARAMETER: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_PARAMETER:") ); break;
- }
- if( eType != TT_EOL )
- {
- aOut += String( pStartPos, (sal_uInt16)( pEndPos - pStartPos ) );
- }
- aOut += String( RTL_CONSTASCII_USTRINGPARAM("\n") );
- return aOut;
-}
-#endif
-
SimpleTokenizer_Impl::SimpleTokenizer_Impl( HighlighterLanguage aLang ): aLanguage(aLang)
{
memset( aCharTypeTab, 0, sizeof( aCharTypeTab ) );
diff --git a/svtools/source/edit/textdoc.cxx b/svtools/source/edit/textdoc.cxx
index fa7536035288..615ac1258f4d 100644
--- a/svtools/source/edit/textdoc.cxx
+++ b/svtools/source/edit/textdoc.cxx
@@ -216,23 +216,6 @@ void TextCharAttribList::DeleteEmptyAttribs()
mbHasEmptyAttribs = sal_False;
}
-#ifdef DBG_UTIL
-sal_Bool TextCharAttribList::DbgCheckAttribs()
-{
- sal_Bool bOK = sal_True;
- for ( sal_uInt16 nAttr = 0; nAttr < Count(); nAttr++ )
- {
- TextCharAttrib* pAttr = GetObject( nAttr );
- if ( pAttr->GetStart() > pAttr->GetEnd() )
- {
- bOK = sal_False;
- OSL_FAIL( "Attr verdreht" );
- }
- }
- return bOK;
-}
-#endif
-
// -------------------------------------------------------------------------
// (+) class TextNode
// -------------------------------------------------------------------------
@@ -307,10 +290,6 @@ void TextNode::ExpandAttribs( sal_uInt16 nIndex, sal_uInt16 nNew )
if ( bResort )
maCharAttribs.ResortAttribs();
-
-#ifdef EDITDEBUG
- DBG_ASSERT( CheckOrderedList( (TextCharAttribs*)&maCharAttribs ), "Expand: Start-Liste verdreht" );
-#endif
}
void TextNode::CollapsAttribs( sal_uInt16 nIndex, sal_uInt16 nDeleted )
@@ -374,10 +353,6 @@ void TextNode::CollapsAttribs( sal_uInt16 nIndex, sal_uInt16 nDeleted )
if ( bResort )
maCharAttribs.ResortAttribs();
-
-#ifdef EDITDEBUG
- DBG_ASSERT( CheckOrderedList( (TextCharAttribs)&maCharAttribs ), "Collaps: Start-Liste verdreht" );
-#endif
}
void TextNode::InsertText( sal_uInt16 nPos, const String& rText )
@@ -460,10 +435,6 @@ void TextNode::Append( const TextNode& rNode )
maText += rNode.GetText();
-#ifdef EDITDEBUG
- DBG_ASSERT( maCharAttribs.DbgCheckAttribs(), "Attribute VOR AppendAttribs kaputt" );
-#endif
-
const sal_uInt16 nAttribs = rNode.GetCharAttribs().Count();
for ( sal_uInt16 nAttr = 0; nAttr < nAttribs; nAttr++ )
{
@@ -499,10 +470,6 @@ void TextNode::Append( const TextNode& rNode )
maCharAttribs.InsertAttrib( pNewAttrib );
}
}
-
-#ifdef EDITDEBUG
- DBG_ASSERT( maCharAttribs.DbgCheckAttribs(), "Attribute NACH AppendAttribs kaputt" );
-#endif
}
// -------------------------------------------------------------------------
diff --git a/svtools/source/edit/textdoc.hxx b/svtools/source/edit/textdoc.hxx
index c52190ca4d63..41a134da4899 100644
--- a/svtools/source/edit/textdoc.hxx
+++ b/svtools/source/edit/textdoc.hxx
@@ -69,10 +69,6 @@ public:
TextCharAttrib* FindEmptyAttrib( sal_uInt16 nWhich, sal_uInt16 nPos );
sal_Bool HasAttrib( sal_uInt16 nWhich ) const;
sal_Bool HasBoundingAttrib( sal_uInt16 nBound );
-
-#ifdef DBG_UTIL
- sal_Bool DbgCheckAttribs();
-#endif
};
diff --git a/svtools/source/edit/texteng.cxx b/svtools/source/edit/texteng.cxx
index 15412276e587..9decddde44f9 100644
--- a/svtools/source/edit/texteng.cxx
+++ b/svtools/source/edit/texteng.cxx
@@ -253,12 +253,6 @@ void TextEngine::SetFont( const Font& rFont )
}
}
-void TextEngine::SetDefTab( sal_uInt16 nDefTab )
-{
- mnDefTab = nDefTab;
- // evtl neu setzen?
-}
-
void TextEngine::SetMaxTextLen( sal_uLong nLen )
{
mnMaxTextLen = nLen;
@@ -359,29 +353,6 @@ void TextEngine::SetUpdateMode( sal_Bool bUpdate )
}
}
-sal_Bool TextEngine::DoesKeyMoveCursor( const KeyEvent& rKeyEvent )
-{
- sal_Bool bDoesMove = sal_False;
-
- switch ( rKeyEvent.GetKeyCode().GetCode() )
- {
- case KEY_UP:
- case KEY_DOWN:
- case KEY_LEFT:
- case KEY_RIGHT:
- case KEY_HOME:
- case KEY_END:
- case KEY_PAGEUP:
- case KEY_PAGEDOWN:
- {
- if ( !rKeyEvent.GetKeyCode().IsMod2() )
- bDoesMove = sal_True;
- }
- break;
- }
- return bDoesMove;
-}
-
sal_Bool TextEngine::DoesKeyChangeText( const KeyEvent& rKeyEvent )
{
sal_Bool bDoesChange = sal_False;
@@ -1509,11 +1480,7 @@ void TextEngine::SeekCursor( sal_uLong nPara, sal_uInt16 nPos, Font& rFont, Outp
if ( ( ( pAttrib->GetStart() < nPos ) && ( pAttrib->GetEnd() >= nPos ) )
|| !pNode->GetText().Len() )
{
- if ( pAttrib->Which() != TEXTATTR_FONTCOLOR )
- {
- pAttrib->GetAttr().SetFont( rFont );
- }
- else
+ if ( pAttrib->Which() == TEXTATTR_FONTCOLOR )
{
if ( pOutDev )
pOutDev->SetTextColor( ((TextAttribFontColor&)pAttrib->GetAttr()).GetColor() );
@@ -1553,15 +1520,6 @@ void TextEngine::SeekCursor( sal_uLong nPara, sal_uInt16 nPos, Font& rFont, Outp
}
}
-void TextEngine::SetUpdateMode( sal_Bool bUp, TextView* pCurView, sal_Bool bForceUpdate )
-{
- sal_Bool bChanged = ( GetUpdateMode() != bUp );
-
- mbUpdate = bUp;
- if ( mbUpdate && ( bChanged || bForceUpdate ) )
- FormatAndUpdate( pCurView );
-}
-
void TextEngine::FormatAndUpdate( TextView* pCurView )
{
if ( mbDowning )
@@ -1953,9 +1911,6 @@ void TextEngine::CreateTextPortions( sal_uLong nPara, sal_uInt16 nStartPos )
}
DBG_ASSERT( pTEParaPortion->GetTextPortions().Count(), "Keine Portions?!" );
-#ifdef EDITDEBUG
- DBG_ASSERT( pTEParaPortion->DbgCheckTextPortions(), "Portions kaputt?" );
-#endif
}
void TextEngine::RecalcTextPortion( sal_uLong nPara, sal_uInt16 nStartPos, short nNewChars )
@@ -2048,10 +2003,6 @@ void TextEngine::RecalcTextPortion( sal_uLong nPara, sal_uInt16 nStartPos, short
}
DBG_ASSERT( pTEParaPortion->GetTextPortions().Count(), "RecalcTextPortions: Keine mehr da!" );
}
-
-#ifdef EDITDEBUG
- DBG_ASSERT( pTEParaPortion->DbgCheckTextPortions(), "Portions kaputt?" );
-#endif
}
void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectangle const* pPaintArea, TextSelection const* pPaintRange, TextSelection const* pSelection )
@@ -2242,13 +2193,6 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan
pOutDev->Erase( aTabArea );
}
}
-#ifdef EDITDEBUG
- Rectangle aTabArea( aTmpPos, Point( aTmpPos.X()+nTxtWidth, aTmpPos.Y()+mnCharHeight-1 ) );
- Color aOldColor = pOutDev->GetFillColor();
- pOutDev->SetFillColor( (y%2) ? COL_RED : COL_GREEN );
- pOutDev->DrawRect( aTabArea );
- pOutDev->SetFillColor( aOldColor );
-#endif
}
break;
default: OSL_FAIL( "ImpPaint: Unknown Portion-Type !" );
diff --git a/svtools/source/edit/textundo.cxx b/svtools/source/edit/textundo.cxx
index 660c272397f5..56aea0d2c0fa 100644
--- a/svtools/source/edit/textundo.cxx
+++ b/svtools/source/edit/textundo.cxx
@@ -43,7 +43,6 @@ TYPEINIT1( TextUndoConnectParas, TextUndo );
TYPEINIT1( TextUndoSplitPara, TextUndo );
TYPEINIT1( TextUndoInsertChars, TextUndo );
TYPEINIT1( TextUndoRemoveChars, TextUndo );
-TYPEINIT1( TextUndoSetAttribs, TextUndo );
TextUndoManager::TextUndoManager( TextEngine* p )
@@ -296,44 +295,4 @@ void TextUndoRemoveChars::Redo()
SetSelection( aPaM );
}
-
-TextUndoSetAttribs::TextUndoSetAttribs( TextEngine* pTextEngine, const TextSelection& rSel )
- : TextUndo( pTextEngine ), maSelection( rSel )
-{
- maSelection.Justify();
-// aNewAttribs.Set( rNewItems );
-// mbSetIsRemove = sal_False;
-// mnRemoveWhich = 0;
-// mnSpecial = 0;
-}
-
-TextUndoSetAttribs::~TextUndoSetAttribs()
-{
- // ...............
-}
-
-void TextUndoSetAttribs::Undo()
-{
- for ( sal_uLong nPara = maSelection.GetStart().GetPara(); nPara <= maSelection.GetEnd().GetPara(); nPara++ )
- {
-// ContentAttribsInfo* pInf = aPrevAttribs[ (sal_uInt16)(nPara-aESel.nStartPara) ];
-// GetTextEngine()->RemoveCharAttribs( nPara );
-// TextNode* pNode = GetTextEngine()->GetTextDoc().GetObject( nPara );
-// for ( sal_uInt16 nAttr = 0; nAttr < pInf->GetPrevCharAttribs().Count(); nAttr++ )
-// {
-// GetTextEngine()->GetTextDoc().InsertAttrib( pNode, pX->GetStart(), pX->GetEnd(), *pX->GetItem() );
-// }
- }
- SetSelection( maSelection );
-}
-
-void TextUndoSetAttribs::Redo()
-{
-// if ( !bSetIsRemove )
-// GetTextEngine()->SetAttribs( aSel, aNewAttribs, nSpecial );
-// else
-// GetTextEngine()->RemoveCharAttribs( aSel, bRemoveParaAttribs, nRemoveWhich );
- SetSelection( maSelection );
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/edit/textview.cxx b/svtools/source/edit/textview.cxx
index f2b370a9a923..1ee50008aeaf 100644
--- a/svtools/source/edit/textview.cxx
+++ b/svtools/source/edit/textview.cxx
@@ -1427,22 +1427,6 @@ void TextView::InsertText( const XubString& rStr, sal_Bool bSelect )
}
*/
-// OLD
-TextPaM TextView::CursorLeft( const TextPaM& rPaM, sal_Bool bWordMode )
-{
- return bWordMode ? CursorWordLeft( rPaM ) : CursorLeft( rPaM, (sal_uInt16)i18n::CharacterIteratorMode::SKIPCELL );
-
- // Remove (sal_uInt16) typecasts in this file when removing this method!
-}
-
-// OLD
-TextPaM TextView::CursorRight( const TextPaM& rPaM, sal_Bool bWordMode )
-{
- return bWordMode ? CursorWordRight( rPaM ) : CursorRight( rPaM, (sal_uInt16)i18n::CharacterIteratorMode::SKIPCELL );
-
- // Remove (sal_uInt16) typecasts in this file when removing this method!
-}
-
TextPaM TextView::CursorLeft( const TextPaM& rPaM, sal_uInt16 nCharacterIteratorMode )
{
TextPaM aPaM( rPaM );
@@ -2006,15 +1990,6 @@ void TextView::SetPaintSelection( sal_Bool bPaint )
}
}
-void TextView::SetHighlightSelection( sal_Bool bSelectByHighlight )
-{
- if ( bSelectByHighlight != mpImpl->mbHighlightSelection )
- {
- // Falls umschalten zwischendurch moeglich...
- mpImpl->mbHighlightSelection = bSelectByHighlight;
- }
-}
-
sal_Bool TextView::Read( SvStream& rInput )
{
sal_Bool bDone = mpImpl->mpTextEngine->Read( rInput, &mpImpl->maSelection );
@@ -2022,11 +1997,6 @@ sal_Bool TextView::Read( SvStream& rInput )
return bDone;
}
-sal_Bool TextView::Write( SvStream& rOutput )
-{
- return mpImpl->mpTextEngine->Read( rOutput, &mpImpl->maSelection );
-}
-
bool TextView::ImplTruncateNewText( rtl::OUString& rNewText ) const
{
bool bTruncated = false;
@@ -2439,18 +2409,12 @@ const Point& TextView::GetStartDocPos() const
{ return mpImpl->maStartDocPos; }
void TextView::SetAutoIndentMode( sal_Bool bAutoIndent )
{ mpImpl->mbAutoIndent = bAutoIndent; }
-sal_Bool TextView::IsAutoIndentMode() const
-{ return mpImpl->mbAutoIndent; }
sal_Bool TextView::IsReadOnly() const
{ return mpImpl->mbReadOnly; }
void TextView::SetAutoScroll( sal_Bool bAutoScroll )
{ mpImpl->mbAutoScroll = bAutoScroll; }
sal_Bool TextView::IsAutoScroll() const
{ return mpImpl->mbAutoScroll; }
-sal_Bool TextView::IsPaintSelection() const
-{ return mpImpl->mbPaintSelection; }
-sal_Bool TextView::IsHighlightSelection() const
-{ return mpImpl->mbHighlightSelection; }
sal_Bool TextView::HasSelection() const
{ return mpImpl->maSelection.HasRange(); }
sal_Bool TextView::IsInsertMode() const
diff --git a/svtools/source/edit/txtattr.cxx b/svtools/source/edit/txtattr.cxx
index 022a40ae848f..e932cbee585a 100644
--- a/svtools/source/edit/txtattr.cxx
+++ b/svtools/source/edit/txtattr.cxx
@@ -39,15 +39,6 @@ TextAttrib::~TextAttrib()
{
}
-void TextAttrib::SetFont( Font& ) const
-{
-}
-
-TextAttrib* TextAttrib::Clone() const
-{
- return NULL;
-}
-
int TextAttrib::operator==( const TextAttrib& rAttr ) const
{
return mnWhich == rAttr.mnWhich;
@@ -115,18 +106,6 @@ int TextAttribFontWeight::operator==( const TextAttrib& rAttr ) const
}
-TextAttribHyperLink::TextAttribHyperLink( const XubString& rURL )
- : TextAttrib( TEXTATTR_HYPERLINK ), maURL( rURL )
-{
- maColor = COL_BLUE;
-}
-
-TextAttribHyperLink::TextAttribHyperLink( const XubString& rURL, const XubString& rDescription )
- : TextAttrib( TEXTATTR_HYPERLINK ), maURL( rURL ), maDescription( rDescription )
-{
- maColor = COL_BLUE;
-}
-
TextAttribHyperLink::TextAttribHyperLink( const TextAttribHyperLink& rAttr )
: TextAttrib( rAttr ), maURL( rAttr.maURL ), maDescription( rAttr.maDescription )
{
diff --git a/svtools/source/filter/exportdialog.cxx b/svtools/source/filter/exportdialog.cxx
index 0a03904cf176..47a7a690153f 100644
--- a/svtools/source/filter/exportdialog.cxx
+++ b/svtools/source/filter/exportdialog.cxx
@@ -1512,4 +1512,4 @@ IMPL_LINK( ExportDialog, OK, void *, EMPTYARG )
return 0;
}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/filter/filter2.cxx b/svtools/source/filter/filter2.cxx
index d34825312470..b973c9bdb3b0 100644
--- a/svtools/source/filter/filter2.cxx
+++ b/svtools/source/filter/filter2.cxx
@@ -1352,4 +1352,4 @@ String GraphicDescriptor::GetImportFormatShortName( sal_uInt16 nFormat )
return String( aKeyName, RTL_TEXTENCODING_ASCII_US );
}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/filter/sgfbram.cxx b/svtools/source/filter/sgfbram.cxx
index 8559cbee30eb..0ba3c5ed5833 100644
--- a/svtools/source/filter/sgfbram.cxx
+++ b/svtools/source/filter/sgfbram.cxx
@@ -561,18 +561,6 @@ sal_Bool SgfVectFilter(SvStream& rInp, GDIMetaFile& rMtf)
return(bRet);
}
-
-/*************************************************************************
-|*
-|* SgfFilterPScr()
-|*
-*************************************************************************/
-sal_Bool SgfFilterPScr(SvStream&, SgfHeader&, SgfEntry&)
-{
- return sal_False; // PostSrcipt wird noch nicht unterstuetzt !
-}
-
-
/*************************************************************************
|*
|* CheckSgfTyp()
diff --git a/svtools/source/filter/sgvtext.cxx b/svtools/source/filter/sgvtext.cxx
index ddda27f2efa2..ed83389d8fee 100644
--- a/svtools/source/filter/sgvtext.cxx
+++ b/svtools/source/filter/sgvtext.cxx
@@ -235,23 +235,7 @@ short hPoint2Sgf(short a)
return short(b);
}
-short Sgf2hPoint(short a)
-{
- long b;
- b=long(a)*5*144/(127*SgfDpmm);
- return short(b);
-}
-
// End of Misc.Pas
-/////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////
-
-
-
-/////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////
// AbsRead.Pas
// ======================================================================
@@ -304,32 +288,6 @@ UCHAR ConvertTextChar(UCHAR c)
return c;
}
-
-
-sal_uInt16 GetSchnittBit(UCHAR c)
-{
- sal_uInt16 r=0;
- switch (c) {
- case EscBold : r=TextBoldBit; break;
- case EscRSlnt: r=TextRSlnBit; break;
- case EscUndln: r=TextUndlBit; break;
- case EscStrik: r=TextStrkBit; break;
- case EscDbUnd: r=TextDbUnBit; break;
- case EscDbStk: r=TextDbStBit; break;
- case EscSupSc: r=TextSupSBit; break;
- case EscSubSc: r=TextSubSBit; break;
- case EscKaptF: r=TextKaptBit; break;
- case EscLSlnt: r=TextLSlnBit; break;
- case Esc2DShd: r=TextSh2DBit; break;
- case Esc3DShd: r=TextSh3DBit; break;
- case Esc4DShd: r=TextSh4DBit; break;
- case EscEbShd: r=TextShEbBit;
- }
- return r;
-}
-
-
-
long ChgValue(long Def, long Min, long Max, UCHAR FlgVal, long NumVal)
{
long r=0;
diff --git a/svtools/source/filter/wmf/emfwr.cxx b/svtools/source/filter/wmf/emfwr.cxx
index 4efaa1bbbb88..09cd1876bf96 100644
--- a/svtools/source/filter/wmf/emfwr.cxx
+++ b/svtools/source/filter/wmf/emfwr.cxx
@@ -30,6 +30,7 @@
#include "precompiled_svtools.hxx"
#include "emfwr.hxx"
+#include <rtl/strbuf.hxx>
#include <vcl/salbtype.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b2dpolypolygon.hxx>
@@ -1429,7 +1430,9 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
break;
default:
- OSL_FAIL( ( ByteString( "EMFWriter::ImplWriteActions: unsupported MetaAction #" ) += ByteString::CreateFromInt32( nType ) ).GetBuffer() );
+ OSL_FAIL(rtl::OStringBuffer(RTL_CONSTASCII_STRINGPARAM(
+ "EMFWriter::ImplWriteActions: unsupported MetaAction #" )).
+ append(static_cast<sal_Int32>(nType)).getStr());
break;
}
}
diff --git a/svtools/source/filter/wmf/enhwmf.cxx b/svtools/source/filter/wmf/enhwmf.cxx
index 23990473aa60..ce7842b0c270 100644
--- a/svtools/source/filter/wmf/enhwmf.cxx
+++ b/svtools/source/filter/wmf/enhwmf.cxx
@@ -261,22 +261,27 @@ void EnhWMFReader::ReadEMFPlusComment(sal_uInt32 length, sal_Bool& bHaveDC)
}
bEMFPlus = true;
+ sal_Size pos = pWMF->Tell();
void *buffer = malloc( length );
-
- int pos = pWMF->Tell();
pOut->PassEMFPlus( buffer, pWMF->Read( buffer, length ) );
+ free( buffer );
pWMF->Seek( pos );
bHaveDC = false;
- length -= 4;
+ OSL_ASSERT(length >= 4);
+ //reduce by 32bit length itself, skip in SeekRel if
+ //impossibly unavailble
+ sal_uInt32 nRemainder = length >= 4 ? length-4 : length;
- while (length > 0) {
- sal_uInt16 type, flags;
- sal_uInt32 size, dataSize;
- sal_uInt32 next;
+ const size_t nRequiredHeaderSize = 12;
+ while (nRemainder > nRequiredHeaderSize)
+ {
+ sal_uInt16 type(0), flags(0);
+ sal_uInt32 size(0), dataSize(0);
*pWMF >> type >> flags >> size >> dataSize;
+ nRemainder -= nRequiredHeaderSize;
EMFP_DEBUG(printf ("\t\tEMF+ record type: %d\n", type));
@@ -286,14 +291,16 @@ void EnhWMFReader::ReadEMFPlusComment(sal_uInt32 length, sal_Bool& bHaveDC)
EMFP_DEBUG(printf ("\t\tEMF+ lock DC (device context)\n", type));
}
- next = pWMF->Tell() + ( size - 12 );
-
- length -= size;
-
- pWMF->Seek( next );
+ //Get the length of the remaining data of this record based
+ //on the alleged size
+ sal_uInt32 nRemainingRecordData = size >= nRequiredHeaderSize ?
+ size-nRequiredHeaderSize : 0;
+ //clip to available size
+ nRemainingRecordData = std::min(nRemainingRecordData, nRemainder);
+ pWMF->SeekRel(nRemainingRecordData);
+ nRemainder -= nRemainingRecordData;
}
-
- free( buffer );
+ pWMF->SeekRel(nRemainder);
}
void EnhWMFReader::ReadGDIComment()
diff --git a/svtools/source/filter/wmf/winmtf.hxx b/svtools/source/filter/wmf/winmtf.hxx
index 16e9296a2b8f..270af93a4675 100644
--- a/svtools/source/filter/wmf/winmtf.hxx
+++ b/svtools/source/filter/wmf/winmtf.hxx
@@ -298,7 +298,6 @@ struct WMF_APMFILEHEADER;
//============================ WMFReader ==================================
-
#ifdef WIN_MTF_ASSERT
#define WIN_MTF_ASSERT_INIT 0x80000000
#define WIN_MTF_ASSERT_ONCE 0x40000000
@@ -319,35 +318,34 @@ public :
void excludeClipRect( const Rectangle& rRect );
void moveClipRegion( const Size& rSize );
- bool isEmpty() const { return maClip.isCleared(); }
+ bool isEmpty() const { return maClip.isCleared(); }
basegfx::B2DPolyPolygon getClipPath() const;
- bool operator==( const WinMtfClipPath& rPath ) const
- {
- return maClip == rPath.maClip;
- };
+ bool operator==( const WinMtfClipPath& rPath ) const
+ {
+ return maClip == rPath.maClip;
+ };
};
class WinMtfPathObj : public PolyPolygon
{
- sal_Bool bClosed;
+ sal_Bool bClosed;
- public :
+public :
WinMtfPathObj() { bClosed = sal_True; }
- void Init() { Clear(); bClosed = sal_True; };
- void ClosePath();
-
- void AddPoint( const Point& rPoint );
- void AddPolygon( const Polygon& rPoly );
- void AddPolyLine( const Polygon& rPoly );
- void AddPolyPolygon( const PolyPolygon& rPolyPolygon );
+ void Init() { Clear(); bClosed = sal_True; };
+ void ClosePath();
+ void AddPoint( const Point& rPoint );
+ void AddPolygon( const Polygon& rPoly );
+ void AddPolyLine( const Polygon& rPoly );
+ void AddPolyPolygon( const PolyPolygon& rPolyPolygon );
};
struct WinMtfFontStyle
{
- Font aFont;
+ Font aFont;
WinMtfFontStyle( LOGFONTW& rLogFont );
};
@@ -362,7 +360,7 @@ typedef enum {
struct WinMtfFillStyle
{
Color aFillColor;
- sal_Bool bTransparent;
+ sal_Bool bTransparent;
WinMtfFillStyleType aType;
Bitmap aBmp;
@@ -387,11 +385,35 @@ struct WinMtfFillStyle
}
sal_Bool operator==( const WinMtfFillStyle& rStyle )
- { return ( ( aFillColor == rStyle.aFillColor ) && ( bTransparent == rStyle.bTransparent ) && ( aType == rStyle.aType ) ); }
+ {
+ return ( ( aFillColor == rStyle.aFillColor )
+ && ( bTransparent == rStyle.bTransparent )
+ && ( aType == rStyle.aType )
+ );
+ }
sal_Bool operator==( WinMtfFillStyle* pStyle )
- { return ( ( aFillColor == pStyle->aFillColor ) && ( bTransparent == pStyle->bTransparent ) && ( aType == pStyle->aType ) ); }
- WinMtfFillStyle& operator=( const WinMtfFillStyle& rStyle ) { aFillColor = rStyle.aFillColor; bTransparent = rStyle.bTransparent; aBmp = rStyle.aBmp; aType = rStyle.aType; return *this; }
- WinMtfFillStyle& operator=( WinMtfFillStyle* pStyle ) { aFillColor = pStyle->aFillColor; bTransparent = pStyle->bTransparent; aBmp = pStyle->aBmp; aType = pStyle->aType; return *this; }
+ {
+ return ( ( aFillColor == pStyle->aFillColor )
+ && ( bTransparent == pStyle->bTransparent )
+ && ( aType == pStyle->aType )
+ );
+ }
+ WinMtfFillStyle& operator=( const WinMtfFillStyle& rStyle )
+ {
+ aFillColor = rStyle.aFillColor;
+ bTransparent = rStyle.bTransparent;
+ aBmp = rStyle.aBmp;
+ aType = rStyle.aType;
+ return *this;
+ }
+ WinMtfFillStyle& operator=( WinMtfFillStyle* pStyle )
+ {
+ aFillColor = pStyle->aFillColor;
+ bTransparent = pStyle->bTransparent;
+ aBmp = pStyle->aBmp;
+ aType = pStyle->aType;
+ return *this;
+ }
};
// -----------------------------------------------------------------------------
@@ -415,8 +437,20 @@ struct WinMtfLineStyle
aLineInfo ( rStyle ),
bTransparent( bTrans ) {}
- sal_Bool operator==( const WinMtfLineStyle& rStyle ) { return ( ( aLineColor == rStyle.aLineColor ) && ( bTransparent == rStyle.bTransparent ) && ( aLineInfo == rStyle.aLineInfo ) ); }
- sal_Bool operator==( WinMtfLineStyle* pStyle ) { return ( ( aLineColor == pStyle->aLineColor ) && ( bTransparent == pStyle->bTransparent ) && ( aLineInfo == pStyle->aLineInfo ) ); }
+ sal_Bool operator==( const WinMtfLineStyle& rStyle )
+ {
+ return ( ( aLineColor == rStyle.aLineColor )
+ && ( bTransparent == rStyle.bTransparent )
+ && ( aLineInfo == rStyle.aLineInfo )
+ );
+ }
+ sal_Bool operator==( WinMtfLineStyle* pStyle )
+ {
+ return ( ( aLineColor == pStyle->aLineColor )
+ && ( bTransparent == pStyle->bTransparent )
+ && ( aLineInfo == pStyle->aLineInfo )
+ );
+ }
WinMtfLineStyle& operator=( const WinMtfLineStyle& rStyle )
{
aLineColor = rStyle.aLineColor;
@@ -490,13 +524,30 @@ struct BSaveStruct
sal_uInt32 nWinRop;
WinMtfFillStyle aStyle;
- BSaveStruct( const Bitmap& rBmp, const Rectangle& rOutRect, sal_uInt32 nRop, WinMtfFillStyle& rStyle ) :
- aBmp( rBmp ), aOutRect( rOutRect ), nWinRop( nRop ), aStyle ( rStyle ){}
+ BSaveStruct(
+ const Bitmap& rBmp,
+ const Rectangle& rOutRect,
+ sal_uInt32 nRop,
+ WinMtfFillStyle& rStyle
+ )
+ : aBmp( rBmp )
+ , aOutRect( rOutRect )
+ , nWinRop( nRop )
+ , aStyle ( rStyle )
+ {}
};
// -----------------------------------------------------------------------------
-enum GDIObjectType { GDI_DUMMY = 0, GDI_PEN = 1, GDI_BRUSH = 2, GDI_FONT = 3, GDI_PALETTE = 4, GDI_BITMAP = 5, GDI_REGION = 6 };
+enum GDIObjectType {
+ GDI_DUMMY = 0,
+ GDI_PEN = 1,
+ GDI_BRUSH = 2,
+ GDI_FONT = 3,
+ GDI_PALETTE = 4,
+ GDI_BITMAP = 5,
+ GDI_REGION = 6
+};
struct GDIObj
{
@@ -546,163 +597,193 @@ struct GDIObj
class WinMtfOutput
{
- WinMtfPathObj aPathObj;
- WinMtfClipPath aClipPath;
-
- WinMtfLineStyle maLatestLineStyle;
- WinMtfLineStyle maLineStyle;
- WinMtfFillStyle maLatestFillStyle;
- WinMtfFillStyle maFillStyle;
- Font maLatestFont;
- Font maFont;
- sal_uInt32 mnLatestTextAlign;
- sal_uInt32 mnTextAlign;
- Color maLatestTextColor;
- Color maTextColor;
- Color maLatestBkColor;
- Color maBkColor;
- sal_uInt32 mnLatestTextLayoutMode;
- sal_uInt32 mnTextLayoutMode;
- sal_uInt32 mnLatestBkMode;
- sal_uInt32 mnBkMode;
- RasterOp meLatestRasterOp;
- RasterOp meRasterOp;
-
- std::vector< GDIObj* > vGDIObj;
-
- Point maActPos;
-
- sal_uInt32 mnRop;
- sal_Bool mbNopMode;
- sal_Bool mbFillStyleSelected;
- sal_Bool mbClipNeedsUpdate;
- sal_Bool mbComplexClip;
-
- std::vector< SaveStructPtr > vSaveStack;
-
- sal_uInt32 mnGfxMode;
- sal_uInt32 mnMapMode;
- sal_uInt16 mnUnitsPerInch;
-
- XForm maXForm;
- sal_Int32 mnDevOrgX, mnDevOrgY;
- sal_Int32 mnDevWidth, mnDevHeight;
- sal_Int32 mnWinOrgX, mnWinOrgY; // aktuelles Window-Origin
- sal_Int32 mnWinExtX, mnWinExtY; // aktuelles Window-Extent
-
- sal_Int32 mnPixX, mnPixY; // Reference Device in pixel
- sal_Int32 mnMillX, mnMillY; // Reference Device in Mill
- Rectangle mrclFrame; // rectangle in logical units 1/100th mm
- Rectangle mrclBounds;
-
- GDIMetaFile* mpGDIMetaFile;
-
- void UpdateLineStyle();
- void UpdateFillStyle();
-
- Point ImplMap( const Point& rPt );
- Size ImplMap( const Size& rSz );
- Rectangle ImplMap( const Rectangle& rRectangle );
- void ImplMap( Font& rFont );
- Polygon& ImplMap( Polygon& rPolygon );
- PolyPolygon& ImplMap( PolyPolygon& rPolyPolygon );
- void ImplResizeObjectArry( sal_uInt32 nNewEntry );
- void ImplSetNonPersistentLineColorTransparenz();
- void ImplDrawClippedPolyPolygon( const PolyPolygon& rPolyPoly );
- void ImplDrawBitmap( const Point& rPos, const Size& rSize, const BitmapEx rBitmap );
-
- public:
-
- void SetDevOrg( const Point& rPoint );
- void SetDevOrgOffset( sal_Int32 nXAdd, sal_Int32 nYAdd );
- void SetDevExt( const Size& rSize );
- void ScaleDevExt( double fX, double fY );
-
- void SetWinOrg( const Point& rPoint );
- void SetWinOrgOffset( sal_Int32 nX, sal_Int32 nY );
- void SetWinExt( const Size& rSize );
- void ScaleWinExt( double fX, double fY );
-
- void SetrclBounds( const Rectangle& rRect );
- void SetrclFrame( const Rectangle& rRect );
- void SetRefPix( const Size& rSize );
- void SetRefMill( const Size& rSize );
-
- sal_uInt32 GetMapMode() const { return mnMapMode; };
- void SetMapMode( sal_uInt32 mnMapMode );
- void SetUnitsPerInch( sal_uInt16 nUnitsPerInch );
- void SetWorldTransform( const XForm& rXForm );
- void ModifyWorldTransform( const XForm& rXForm, sal_uInt32 nMode );
-
- void Push();
- void Pop();
-
- sal_uInt32 SetRasterOp( sal_uInt32 nRasterOp );
- void StrokeAndFillPath( sal_Bool bStroke, sal_Bool bFill );
-
- void SetGfxMode( sal_Int32 nGfxMode ){ mnGfxMode = nGfxMode; };
- sal_Int32 GetGfxMode() const { return mnGfxMode; };
- void SetBkMode( sal_uInt32 nMode );
- void SetBkColor( const Color& rColor );
- void SetTextColor( const Color& rColor );
- void SetTextAlign( sal_uInt32 nAlign );
- void CreateObject( GDIObjectType, void* pStyle = NULL );
- void CreateObject( sal_Int32 nIndex, GDIObjectType, void* pStyle = NULL );
- void DeleteObject( sal_Int32 nIndex );
- void SelectObject( sal_Int32 nIndex );
- CharSet GetCharSet(){ return maFont.GetCharSet(); };
- WinMtfFillStyle& GetFillStyle () { return maFillStyle; }
- void SetFont( const Font& rFont );
- const Font& GetFont() const;
- void SetTextLayoutMode( const sal_uInt32 nLayoutMode );
- sal_uInt32 GetTextLayoutMode() const;
-
- void ClearPath(){ aPathObj.Init(); };
- void ClosePath(){ aPathObj.ClosePath(); };
- const PolyPolygon& GetPathObj(){ return aPathObj; };
-
- void MoveTo( const Point& rPoint, sal_Bool bRecordPath = sal_False );
- void LineTo( const Point& rPoint, sal_Bool bRecordPath = sal_False );
- void DrawPixel( const Point& rSource, const Color& rColor );
- void DrawLine( const Point& rSource, const Point& rDest );
- void DrawRect( const Rectangle& rRect, sal_Bool bEdge = sal_True );
- void DrawRoundRect( const Rectangle& rRect, const Size& rSize );
- void DrawEllipse( const Rectangle& rRect );
- void DrawArc( const Rectangle& rRect, const Point& rStartAngle, const Point& rEndAngle, sal_Bool bDrawTo = sal_False );
- void DrawPie( const Rectangle& rRect, const Point& rStartAngle, const Point& rEndAngle );
- void DrawChord( const Rectangle& rRect, const Point& rStartAngle, const Point& rEndAngle );
- void DrawPolygon( Polygon& rPolygon, sal_Bool bRecordPath = sal_False );
- void DrawPolyPolygon( PolyPolygon& rPolyPolygon, sal_Bool bRecordPath = sal_False );
- void DrawPolyLine( Polygon& rPolygon, sal_Bool bDrawTo = sal_False, sal_Bool bRecordPath = sal_False );
- void DrawPolyBezier( Polygon& rPolygin, sal_Bool bDrawTo = sal_False, sal_Bool bRecordPath = sal_False );
- void DrawText( Point& rPosition, String& rString, sal_Int32* pDXArry = NULL, sal_Bool bRecordPath = sal_False,
- sal_Int32 nGraphicsMode = GM_COMPATIBLE );
- void ResolveBitmapActions( List& rSaveList );
-
- void IntersectClipRect( const Rectangle& rRect );
- void ExcludeClipRect( const Rectangle& rRect );
- void MoveClipRegion( const Size& rSize );
- void SetClipPath( const PolyPolygon& rPolyPoly, sal_Int32 nClippingMode, sal_Bool bIsMapped );
- void UpdateClipRegion();
- void AddFromGDIMetaFile( GDIMetaFile& rGDIMetaFile );
-
- void PassEMFPlus( void* pBuffer, sal_uInt32 nLength );
- void PassEMFPlusHeaderInfo();
-
- WinMtfOutput( GDIMetaFile& rGDIMetaFile );
- virtual ~WinMtfOutput();
+ WinMtfPathObj aPathObj;
+ WinMtfClipPath aClipPath;
+
+ WinMtfLineStyle maLatestLineStyle;
+ WinMtfLineStyle maLineStyle;
+ WinMtfFillStyle maLatestFillStyle;
+ WinMtfFillStyle maFillStyle;
+ Font maLatestFont;
+ Font maFont;
+ sal_uInt32 mnLatestTextAlign;
+ sal_uInt32 mnTextAlign;
+ Color maLatestTextColor;
+ Color maTextColor;
+ Color maLatestBkColor;
+ Color maBkColor;
+ sal_uInt32 mnLatestTextLayoutMode;
+ sal_uInt32 mnTextLayoutMode;
+ sal_uInt32 mnLatestBkMode;
+ sal_uInt32 mnBkMode;
+ RasterOp meLatestRasterOp;
+ RasterOp meRasterOp;
+
+ std::vector< GDIObj* > vGDIObj;
+
+ Point maActPos;
+
+ sal_uInt32 mnRop;
+ sal_Bool mbNopMode;
+ sal_Bool mbFillStyleSelected;
+ sal_Bool mbClipNeedsUpdate;
+ sal_Bool mbComplexClip;
+
+ std::vector< SaveStructPtr > vSaveStack;
+
+ sal_uInt32 mnGfxMode;
+ sal_uInt32 mnMapMode;
+ sal_uInt16 mnUnitsPerInch;
+
+ XForm maXForm;
+ sal_Int32 mnDevOrgX, mnDevOrgY;
+ sal_Int32 mnDevWidth, mnDevHeight;
+ sal_Int32 mnWinOrgX, mnWinOrgY; // aktuelles Window-Origin
+ sal_Int32 mnWinExtX, mnWinExtY; // aktuelles Window-Extent
+
+ sal_Int32 mnPixX, mnPixY; // Reference Device in pixel
+ sal_Int32 mnMillX, mnMillY; // Reference Device in Mill
+ Rectangle mrclFrame; // rectangle in logical units 1/100th mm
+ Rectangle mrclBounds;
+
+ GDIMetaFile* mpGDIMetaFile;
+
+ void UpdateLineStyle();
+ void UpdateFillStyle();
+
+ Point ImplMap( const Point& rPt );
+ Size ImplMap( const Size& rSz );
+ Rectangle ImplMap( const Rectangle& rRectangle );
+ void ImplMap( Font& rFont );
+ Polygon& ImplMap( Polygon& rPolygon );
+ PolyPolygon& ImplMap( PolyPolygon& rPolyPolygon );
+ void ImplResizeObjectArry( sal_uInt32 nNewEntry );
+ void ImplSetNonPersistentLineColorTransparenz();
+ void ImplDrawClippedPolyPolygon( const PolyPolygon& rPolyPoly );
+ void ImplDrawBitmap( const Point& rPos, const Size& rSize, const BitmapEx rBitmap );
+
+public:
+
+ void SetDevOrg( const Point& rPoint );
+ void SetDevOrgOffset( sal_Int32 nXAdd, sal_Int32 nYAdd );
+ void SetDevExt( const Size& rSize );
+ void ScaleDevExt( double fX, double fY );
+
+ void SetWinOrg( const Point& rPoint );
+ void SetWinOrgOffset( sal_Int32 nX, sal_Int32 nY );
+ void SetWinExt( const Size& rSize );
+ void ScaleWinExt( double fX, double fY );
+
+ void SetrclBounds( const Rectangle& rRect );
+ void SetrclFrame( const Rectangle& rRect );
+ void SetRefPix( const Size& rSize );
+ void SetRefMill( const Size& rSize );
+
+ sal_uInt32 GetMapMode() const { return mnMapMode; };
+ void SetMapMode( sal_uInt32 mnMapMode );
+ void SetUnitsPerInch( sal_uInt16 nUnitsPerInch );
+ void SetWorldTransform( const XForm& rXForm );
+ void ModifyWorldTransform( const XForm& rXForm, sal_uInt32 nMode );
+
+ void Push();
+ void Pop();
+
+ sal_uInt32 SetRasterOp( sal_uInt32 nRasterOp );
+ void StrokeAndFillPath( sal_Bool bStroke, sal_Bool bFill );
+
+ void SetGfxMode( sal_Int32 nGfxMode ){ mnGfxMode = nGfxMode; };
+ sal_Int32 GetGfxMode() const { return mnGfxMode; };
+ void SetBkMode( sal_uInt32 nMode );
+ void SetBkColor( const Color& rColor );
+ void SetTextColor( const Color& rColor );
+ void SetTextAlign( sal_uInt32 nAlign );
+ void CreateObject( GDIObjectType, void* pStyle = NULL );
+ void CreateObject( sal_Int32 nIndex, GDIObjectType, void* pStyle = NULL );
+ void DeleteObject( sal_Int32 nIndex );
+ void SelectObject( sal_Int32 nIndex );
+ CharSet GetCharSet(){ return maFont.GetCharSet(); };
+ WinMtfFillStyle& GetFillStyle () { return maFillStyle; }
+ void SetFont( const Font& rFont );
+ const Font& GetFont() const;
+ void SetTextLayoutMode( const sal_uInt32 nLayoutMode );
+ sal_uInt32 GetTextLayoutMode() const;
+
+ void ClearPath(){ aPathObj.Init(); };
+ void ClosePath(){ aPathObj.ClosePath(); };
+ const PolyPolygon& GetPathObj(){ return aPathObj; };
+
+ void MoveTo( const Point& rPoint, sal_Bool bRecordPath = sal_False );
+ void LineTo( const Point& rPoint, sal_Bool bRecordPath = sal_False );
+ void DrawPixel( const Point& rSource, const Color& rColor );
+ void DrawLine( const Point& rSource, const Point& rDest );
+ void DrawRect( const Rectangle& rRect, sal_Bool bEdge = sal_True );
+ void DrawRoundRect( const Rectangle& rRect, const Size& rSize );
+ void DrawEllipse( const Rectangle& rRect );
+ void DrawArc(
+ const Rectangle& rRect,
+ const Point& rStartAngle,
+ const Point& rEndAngle,
+ sal_Bool bDrawTo = sal_False
+ );
+ void DrawPie(
+ const Rectangle& rRect,
+ const Point& rStartAngle,
+ const Point& rEndAngle
+ );
+ void DrawChord(
+ const Rectangle& rRect,
+ const Point& rStartAngle,
+ const Point& rEndAngle
+ );
+ void DrawPolygon( Polygon& rPolygon, sal_Bool bRecordPath = sal_False );
+ void DrawPolyPolygon( PolyPolygon& rPolyPolygon, sal_Bool bRecordPath = sal_False );
+ void DrawPolyLine(
+ Polygon& rPolygon,
+ sal_Bool bDrawTo = sal_False,
+ sal_Bool bRecordPath = sal_False
+ );
+ void DrawPolyBezier(
+ Polygon& rPolygin,
+ sal_Bool bDrawTo = sal_False,
+ sal_Bool bRecordPath = sal_False
+ );
+ void DrawText(
+ Point& rPosition,
+ String& rString,
+ sal_Int32* pDXArry = NULL,
+ sal_Bool bRecordPath = sal_False,
+ sal_Int32 nGraphicsMode = GM_COMPATIBLE
+ );
+ void ResolveBitmapActions( List& rSaveList );
+
+ void IntersectClipRect( const Rectangle& rRect );
+ void ExcludeClipRect( const Rectangle& rRect );
+ void MoveClipRegion( const Size& rSize );
+ void SetClipPath(
+ const PolyPolygon& rPolyPoly,
+ sal_Int32 nClippingMode,
+ sal_Bool bIsMapped
+ );
+ void UpdateClipRegion();
+ void AddFromGDIMetaFile( GDIMetaFile& rGDIMetaFile );
+
+ void PassEMFPlus( void* pBuffer, sal_uInt32 nLength );
+ void PassEMFPlusHeaderInfo();
+
+ WinMtfOutput( GDIMetaFile& rGDIMetaFile );
+ virtual ~WinMtfOutput();
};
// -----------------------------------------------------------------------------
class WinMtf
{
- protected:
+protected:
WinMtfOutput* pOut; //
SvStream* pWMF; // Die einzulesende WMF/EMF-Datei
- sal_uInt32 nStartPos, nEndPos;
+ sal_uInt32 nStartPos, nEndPos;
List aBmpSaveList;
FilterConfigItem* pFilterConfigItem;
@@ -714,10 +795,14 @@ class WinMtf
Color ReadColor();
void Callback( sal_uInt16 nPercent );
- WinMtf( WinMtfOutput* pOut, SvStream& rStreamWMF, FilterConfigItem* pConfigItem = NULL );
+ WinMtf(
+ WinMtfOutput* pOut,
+ SvStream& rStreamWMF,
+ FilterConfigItem* pConfigItem = NULL
+ );
~WinMtf();
- public:
+public:
};
@@ -730,16 +815,26 @@ class EnhWMFReader : public WinMtf
sal_Bool bEMFPlus;
- sal_Bool ReadHeader();
- Rectangle ReadRectangle( sal_Int32, sal_Int32, sal_Int32, sal_Int32 ); // Liesst und konvertiert ein Rechteck
+ sal_Bool ReadHeader();
+ // Liesst und konvertiert ein Rechteck
+ Rectangle ReadRectangle( sal_Int32, sal_Int32, sal_Int32, sal_Int32 );
void ImplExtTextOut( sal_Bool bWideCharakter );
public:
- EnhWMFReader( SvStream& rStreamWMF, GDIMetaFile& rGDIMetaFile, FilterConfigItem* pConfigItem = NULL )
- : WinMtf( new WinMtfOutput( rGDIMetaFile ), rStreamWMF, pConfigItem ), bRecordPath( sal_False ), bEMFPlus( sal_False ) {};
+ EnhWMFReader(
+ SvStream& rStreamWMF,
+ GDIMetaFile& rGDIMetaFile,
+ FilterConfigItem* pConfigItem = NULL
+ )
+ : WinMtf( new WinMtfOutput( rGDIMetaFile )
+ , rStreamWMF
+ , pConfigItem )
+ , bRecordPath( sal_False )
+ , bEMFPlus( sal_False )
+ {};
~EnhWMFReader();
- sal_Bool ReadEnhWMF();
+ sal_Bool ReadEnhWMF();
void ReadEMFPlusComment(sal_uInt32 length, sal_Bool& bHaveDC);
void ReadGDIComment();
};
@@ -751,7 +846,7 @@ class WMFReader : public WinMtf
private:
VirtualDevice aVDev; // just for the purpose of "IsFontAvailable"
- sal_uInt16 nUnitsPerInch;
+ sal_uInt16 nUnitsPerInch;
sal_uInt32 nRecSize;
// embedded EMF data
@@ -771,7 +866,7 @@ private:
sal_uInt32 nUnicodeEscapeAction;
// Liesst den Kopf der WMF-Datei
- sal_Bool ReadHeader(WMF_APMFILEHEADER *pAPMHeader);
+ sal_Bool ReadHeader( WMF_APMFILEHEADER *pAPMHeader );
// Liesst die Parameter des Rocords mit der Funktionsnummer nFunction.
void ReadRecordParams( sal_uInt16 nFunction );
@@ -784,10 +879,14 @@ private:
public:
- WMFReader( SvStream& rStreamWMF, GDIMetaFile& rGDIMetaFile, FilterConfigItem* pConfigItem = NULL )
+ WMFReader(
+ SvStream& rStreamWMF,
+ GDIMetaFile& rGDIMetaFile,
+ FilterConfigItem* pConfigItem = NULL
+ )
: WinMtf( new WinMtfOutput( rGDIMetaFile ), rStreamWMF, pConfigItem )
, pEMFStream(NULL)
- {}
+ {}
~WMFReader();
diff --git a/svtools/source/filter/wmf/wmf.cxx b/svtools/source/filter/wmf/wmf.cxx
index 9b2a8edf2d6e..03923ddc508a 100644
--- a/svtools/source/filter/wmf/wmf.cxx
+++ b/svtools/source/filter/wmf/wmf.cxx
@@ -102,13 +102,6 @@ sal_Bool ConvertGDIMetaFileToEMF( const GDIMetaFile & rMTF, SvStream & rTargetSt
// -----------------------------------------------------------------------------
-sal_Bool WriteWindowMetafile( SvStream& rStream, const GDIMetaFile& rMTF )
-{
- return WMFWriter().WriteWMF( rMTF, rStream, NULL );
-}
-
-// -----------------------------------------------------------------------------
-
sal_Bool WriteWindowMetafileBits( SvStream& rStream, const GDIMetaFile& rMTF )
{
return WMFWriter().WriteWMF( rMTF, rStream, NULL, sal_False );
diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx
index df7bfa9f88b1..e0aa6595f6ac 100644
--- a/svtools/source/graphic/grfcache.cxx
+++ b/svtools/source/graphic/grfcache.cxx
@@ -162,15 +162,16 @@ class GraphicCacheEntry
{
private:
- List maGraphicObjectList;
+ GraphicObjectList_impl maGraphicObjectList;
+
GraphicID maID;
GfxLink maGfxLink;
BitmapEx* mpBmpEx;
GDIMetaFile* mpMtf;
Animation* mpAnimation;
- sal_Bool mbSwappedAll;
+ bool mbSwappedAll;
- sal_Bool ImplInit( const GraphicObject& rObj );
+ bool ImplInit( const GraphicObject& rObj );
void ImplFillSubstitute( Graphic& rSubstitute );
public:
@@ -181,13 +182,13 @@ public:
const GraphicID& GetID() const { return maID; }
void AddGraphicObjectReference( const GraphicObject& rObj, Graphic& rSubstitute );
- sal_Bool ReleaseGraphicObjectReference( const GraphicObject& rObj );
- sal_uLong GetGraphicObjectReferenceCount() { return maGraphicObjectList.Count(); }
- sal_Bool HasGraphicObjectReference( const GraphicObject& rObj );
+ bool ReleaseGraphicObjectReference( const GraphicObject& rObj );
+ size_t GetGraphicObjectReferenceCount() { return maGraphicObjectList.size(); }
+ bool HasGraphicObjectReference( const GraphicObject& rObj );
void TryToSwapIn();
void GraphicObjectWasSwappedOut( const GraphicObject& rObj );
- sal_Bool FillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute );
+ bool FillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute );
void GraphicObjectWasSwappedIn( const GraphicObject& rObj );
};
@@ -200,14 +201,17 @@ GraphicCacheEntry::GraphicCacheEntry( const GraphicObject& rObj ) :
mpAnimation ( NULL ),
mbSwappedAll ( !ImplInit( rObj ) )
{
- maGraphicObjectList.Insert( (void*) &rObj, LIST_APPEND );
+ maGraphicObjectList.push_back( (GraphicObject*)&rObj );
}
// -----------------------------------------------------------------------------
GraphicCacheEntry::~GraphicCacheEntry()
{
- DBG_ASSERT( !maGraphicObjectList.Count(), "GraphicCacheEntry::~GraphicCacheEntry(): Not all GraphicObjects are removed from this entry" );
+ DBG_ASSERT(
+ maGraphicObjectList.empty(),
+ "GraphicCacheEntry::~GraphicCacheEntry(): Not all GraphicObjects are removed from this entry"
+ );
delete mpBmpEx;
delete mpMtf;
@@ -216,9 +220,9 @@ GraphicCacheEntry::~GraphicCacheEntry()
// -----------------------------------------------------------------------------
-sal_Bool GraphicCacheEntry::ImplInit( const GraphicObject& rObj )
+bool GraphicCacheEntry::ImplInit( const GraphicObject& rObj )
{
- sal_Bool bRet;
+ bool bRet = false;
if( !rObj.IsSwappedOut() )
{
@@ -260,10 +264,8 @@ sal_Bool GraphicCacheEntry::ImplInit( const GraphicObject& rObj )
else
maGfxLink = GfxLink();
- bRet = sal_True;
+ bRet = true;
}
- else
- bRet = sal_False;
return bRet;
}
@@ -277,9 +279,9 @@ void GraphicCacheEntry::ImplFillSubstitute( Graphic& rSubstitute )
const MapMode aPrefMapMode( rSubstitute.GetPrefMapMode() );
const Link aAnimationNotifyHdl( rSubstitute.GetAnimationNotifyHdl() );
const String aDocFileName( rSubstitute.GetDocFileName() );
- const sal_uLong nDocFilePos = rSubstitute.GetDocFilePos();
+ const sal_uLong nDocFilePos = rSubstitute.GetDocFilePos();
const GraphicType eOldType = rSubstitute.GetType();
- const sal_Bool bDefaultType = ( rSubstitute.GetType() == GRAPHIC_DEFAULT );
+ const bool bDefaultType = ( rSubstitute.GetType() == GRAPHIC_DEFAULT );
if( rSubstitute.IsLink() && ( GFX_LINK_TYPE_NONE == maGfxLink.GetType() ) )
maGfxLink = rSubstitute.GetLink();
@@ -316,36 +318,37 @@ void GraphicCacheEntry::AddGraphicObjectReference( const GraphicObject& rObj, Gr
mbSwappedAll = !ImplInit( rObj );
ImplFillSubstitute( rSubstitute );
- maGraphicObjectList.Insert( (void*) &rObj, LIST_APPEND );
+ maGraphicObjectList.push_back( (GraphicObject*) &rObj );
}
// -----------------------------------------------------------------------------
-sal_Bool GraphicCacheEntry::ReleaseGraphicObjectReference( const GraphicObject& rObj )
+bool GraphicCacheEntry::ReleaseGraphicObjectReference( const GraphicObject& rObj )
{
- sal_Bool bRet = sal_False;
-
- for( void* pObj = maGraphicObjectList.First(); !bRet && pObj; pObj = maGraphicObjectList.Next() )
- {
- if( &rObj == (GraphicObject*) pObj )
+ for(
+ GraphicObjectList_impl::iterator it = maGraphicObjectList.begin();
+ it != maGraphicObjectList.end();
+ ++it
+ ) {
+ if( &rObj == *it )
{
- maGraphicObjectList.Remove( pObj );
- bRet = sal_True;
+ maGraphicObjectList.erase( it );
+ return true;
}
}
- return bRet;
+ return false;
}
// -----------------------------------------------------------------------------
-sal_Bool GraphicCacheEntry::HasGraphicObjectReference( const GraphicObject& rObj )
+bool GraphicCacheEntry::HasGraphicObjectReference( const GraphicObject& rObj )
{
- sal_Bool bRet = sal_False;
+ bool bRet = false;
- for( void* pObj = maGraphicObjectList.First(); !bRet && pObj; pObj = maGraphicObjectList.Next() )
- if( &rObj == (GraphicObject*) pObj )
- bRet = sal_True;
+ for( size_t i = 0, n = maGraphicObjectList.size(); ( i < n ) && !bRet; ++i )
+ if( &rObj == maGraphicObjectList[ i ] )
+ bRet = true;
return bRet;
}
@@ -354,41 +357,39 @@ sal_Bool GraphicCacheEntry::HasGraphicObjectReference( const GraphicObject& rObj
void GraphicCacheEntry::TryToSwapIn()
{
- if( mbSwappedAll && maGraphicObjectList.Count() )
- ( (GraphicObject*) maGraphicObjectList.First() )->FireSwapInRequest();
+ if( mbSwappedAll && !maGraphicObjectList.empty() )
+ maGraphicObjectList.front()->FireSwapInRequest();
}
// -----------------------------------------------------------------------------
void GraphicCacheEntry::GraphicObjectWasSwappedOut( const GraphicObject& /*rObj*/ )
{
- mbSwappedAll = sal_True;
+ mbSwappedAll = true;
- for( void* pObj = maGraphicObjectList.First(); mbSwappedAll && pObj; pObj = maGraphicObjectList.Next() )
- if( !( (GraphicObject*) pObj )->IsSwappedOut() )
- mbSwappedAll = sal_False;
+ for( size_t i = 0, n = maGraphicObjectList.size(); ( i < n ) && mbSwappedAll; ++i )
+ if( !maGraphicObjectList[ i ]->IsSwappedOut() )
+ mbSwappedAll = false;
if( mbSwappedAll )
{
delete mpBmpEx, mpBmpEx = NULL;
- delete mpMtf, mpMtf = NULL;
+ mpMtf = NULL; // No need to delete it as it has already been dereferenced
delete mpAnimation, mpAnimation = NULL;
}
}
// -----------------------------------------------------------------------------
-sal_Bool GraphicCacheEntry::FillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute )
+bool GraphicCacheEntry::FillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute )
{
- sal_Bool bRet;
+ bool bRet = false;
if( !mbSwappedAll && rObj.IsSwappedOut() )
{
ImplFillSubstitute( rSubstitute );
- bRet = sal_True;
+ bRet = true;
}
- else
- bRet = sal_False;
return bRet;
}
@@ -676,7 +677,7 @@ void GraphicCache::ReleaseGraphicObject( const GraphicObject& rObj )
{
// Release cached object
GraphicCacheEntry* pEntry = (GraphicCacheEntry*) maGraphicCache.First();
- sal_Bool bRemoved = sal_False;
+ bool bRemoved = false;
while( !bRemoved && pEntry )
{
diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx
index 19b09e8f67a7..63df21b3993d 100644
--- a/svtools/source/graphic/grfmgr.cxx
+++ b/svtools/source/graphic/grfmgr.cxx
@@ -547,11 +547,6 @@ void GraphicObject::SetAnimationNotifyHdl( const Link& rLink )
maGraphic.SetAnimationNotifyHdl( rLink );
}
-List* GraphicObject::GetAnimationInfoList() const
-{
- return maGraphic.GetAnimationInfoList();
-}
-
sal_Bool GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz,
const GraphicAttr* pAttr, sal_uLong nFlags )
{
@@ -1232,4 +1227,4 @@ GraphicObject GraphicObject::CreateGraphicObjectFromURL( const ::rtl::OUString &
}
}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx
index 1115635157a8..b5d7b2bcda15 100644
--- a/svtools/source/graphic/grfmgr2.cxx
+++ b/svtools/source/graphic/grfmgr2.cxx
@@ -122,8 +122,8 @@ GraphicManager::GraphicManager( sal_uLong nCacheSize, sal_uLong nMaxObjCacheSize
GraphicManager::~GraphicManager()
{
- for( void* pObj = maObjList.First(); pObj; pObj = maObjList.Next() )
- ( (GraphicObject*) pObj )->GraphicManagerDestroyed();
+ for( size_t i = 0, n = maObjList.size(); i < n; ++i )
+ maObjList[ i ]->GraphicManagerDestroyed();
delete mpCache;
}
@@ -271,7 +271,7 @@ sal_Bool GraphicManager::DrawObj( OutputDevice* pOut, const Point& rPt, const Si
void GraphicManager::ImplRegisterObj( const GraphicObject& rObj, Graphic& rSubstitute,
const ByteString* pID, const GraphicObject* pCopyObj )
{
- maObjList.Insert( (void*) &rObj, LIST_APPEND );
+ maObjList.push_back( (GraphicObject*)&rObj );
mpCache->AddGraphicObject( rObj, rSubstitute, pID, pCopyObj );
}
@@ -280,7 +280,13 @@ void GraphicManager::ImplRegisterObj( const GraphicObject& rObj, Graphic& rSubst
void GraphicManager::ImplUnregisterObj( const GraphicObject& rObj )
{
mpCache->ReleaseGraphicObject( rObj );
- maObjList.Remove( (void*) &rObj );
+ for( GraphicObjectList_impl::iterator it = maObjList.begin(); it < maObjList.end(); ++it )
+ {
+ if ( *it == &rObj ) {
+ maObjList.erase( it );
+ break;
+ }
+ }
}
// -----------------------------------------------------------------------------
@@ -2384,4 +2390,4 @@ void GraphicObject::ImplTransformBitmap( BitmapEx& rBmpEx,
}
}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/hatchwindow/hatchwindowfactory.component b/svtools/source/hatchwindow/hatchwindowfactory.component
index 153fc8796281..b9ebbaefdd04 100644
--- a/svtools/source/hatchwindow/hatchwindowfactory.component
+++ b/svtools/source/hatchwindow/hatchwindowfactory.component
@@ -26,7 +26,7 @@
*
**********************************************************************-->
-<component loader="com.sun.star.loader.SharedLibrary"
+<component loader="com.sun.star.loader.SharedLibrary" prefix="hatchwindowfactory"
xmlns="http://openoffice.org/2010/uno-components">
<implementation name="com.sun.star.comp.embed.DocumentCloser">
<service name="com.sun.star.embed.DocumentCloser"/>
diff --git a/svtools/source/hatchwindow/hatchwindowfactory.cxx b/svtools/source/hatchwindow/hatchwindowfactory.cxx
index a0ff0d4daf17..93401d8f8f43 100644
--- a/svtools/source/hatchwindow/hatchwindowfactory.cxx
+++ b/svtools/source/hatchwindow/hatchwindowfactory.cxx
@@ -109,13 +109,7 @@ uno::Sequence< ::rtl::OUString > SAL_CALL OHatchWindowFactory::getSupportedServi
extern "C"
{
-SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment (
- const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */)
-{
- *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
-}
-
-SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory (
+SAL_DLLPUBLIC_EXPORT void * SAL_CALL hatchwindowfactory_component_getFactory (
const sal_Char * pImplementationName, void * pServiceManager, void * /* pRegistryKey */)
{
void * pResult = 0;
diff --git a/svtools/source/inc/svimpbox.hxx b/svtools/source/inc/svimpbox.hxx
index c7603827f61e..d38046a6f47c 100644
--- a/svtools/source/inc/svimpbox.hxx
+++ b/svtools/source/inc/svimpbox.hxx
@@ -313,6 +313,7 @@ public:
void SetCurEntry( SvLBoxEntry* );
Point GetEntryPosition( SvLBoxEntry* ) const;
void MakeVisible( SvLBoxEntry* pEntry, sal_Bool bMoveToTop=sal_False );
+ void ScrollToAbsPos( long nPos );
void PaintDDCursor( SvLBoxEntry* );
diff --git a/svtools/source/misc/imap.cxx b/svtools/source/misc/imap.cxx
index d4ee29924801..39bb9f83bd87 100644
--- a/svtools/source/misc/imap.cxx
+++ b/svtools/source/misc/imap.cxx
@@ -165,30 +165,6 @@ void IMapObject::Read( SvStream& rIStm, const String& rBaseURL )
/******************************************************************************
|*
-|* Konvertierung der logischen Koordianten in Pixel
-|*
-\******************************************************************************/
-
-Point IMapObject::GetPixelPoint( const Point& rLogPoint )
-{
- return Application::GetDefaultDevice()->LogicToPixel( rLogPoint, MapMode( MAP_100TH_MM ) );
-}
-
-
-/******************************************************************************
-|*
-|* Konvertierung der logischen Koordianten in Pixel
-|*
-\******************************************************************************/
-
-Point IMapObject::GetLogPoint( const Point& rPixelPoint )
-{
- return Application::GetDefaultDevice()->PixelToLogic( rPixelPoint, MapMode( MAP_100TH_MM ) );
-}
-
-
-/******************************************************************************
-|*
|*
|*
\******************************************************************************/
@@ -433,7 +409,7 @@ sal_Bool IMapCircleObject::IsHit( const Point& rPoint ) const
const Point aPoint( aCenter - rPoint );
sal_Bool bRet = sal_False;
- if ( (sal_uLong) sqrt( (double) aPoint.X() * aPoint.X() +
+ if ( (sal_Int32) sqrt( (double) aPoint.X() * aPoint.X() +
aPoint.Y() * aPoint.Y() ) <= nRadius )
{
bRet = sal_True;
@@ -743,8 +719,8 @@ sal_Bool IMapPolygonObject::IsEqual( const IMapPolygonObject& rEqObj )
|*
\******************************************************************************/
-ImageMap::ImageMap( const String& rName ) :
- aName ( rName )
+ImageMap::ImageMap( const String& rName )
+: aName( rName )
{
}
@@ -759,24 +735,24 @@ ImageMap::ImageMap( const ImageMap& rImageMap )
{
DBG_CTOR( ImageMap, NULL );
- sal_uInt16 nCount = rImageMap.GetIMapObjectCount();
+ size_t nCount = rImageMap.GetIMapObjectCount();
- for ( sal_uInt16 i = 0; i < nCount; i++ )
+ for ( size_t i = 0; i < nCount; i++ )
{
IMapObject* pCopyObj = rImageMap.GetIMapObject( i );
switch( pCopyObj->GetType() )
{
case( IMAP_OBJ_RECTANGLE ):
- maList.Insert( new IMapRectangleObject( *(IMapRectangleObject*) pCopyObj ), LIST_APPEND );
+ maList.push_back( new IMapRectangleObject( *(IMapRectangleObject*) pCopyObj ) );
break;
case( IMAP_OBJ_CIRCLE ):
- maList.Insert( new IMapCircleObject( *(IMapCircleObject*) pCopyObj ), LIST_APPEND );
+ maList.push_back( new IMapCircleObject( *(IMapCircleObject*) pCopyObj ) );
break;
case( IMAP_OBJ_POLYGON ):
- maList.Insert( new IMapPolygonObject( *(IMapPolygonObject*) pCopyObj ), LIST_APPEND );
+ maList.push_back( new IMapPolygonObject( *(IMapPolygonObject*) pCopyObj ) );
break;
default:
@@ -810,15 +786,9 @@ ImageMap::~ImageMap()
void ImageMap::ClearImageMap()
{
- IMapObject* pObj = (IMapObject*) maList.First();
-
- while ( pObj )
- {
- delete pObj;
- pObj = (IMapObject*) maList.Next();
- }
-
- maList.Clear();
+ for( size_t i = 0, n = maList.size(); i < n; ++i )
+ delete maList[ i ];
+ maList.clear();
aName = String();
}
@@ -832,26 +802,26 @@ void ImageMap::ClearImageMap()
ImageMap& ImageMap::operator=( const ImageMap& rImageMap )
{
- sal_uInt16 nCount = rImageMap.GetIMapObjectCount();
+ size_t nCount = rImageMap.GetIMapObjectCount();
ClearImageMap();
- for ( sal_uInt16 i = 0; i < nCount; i++ )
+ for ( size_t i = 0; i < nCount; i++ )
{
IMapObject* pCopyObj = rImageMap.GetIMapObject( i );
switch( pCopyObj->GetType() )
{
case( IMAP_OBJ_RECTANGLE ):
- maList.Insert( new IMapRectangleObject( *(IMapRectangleObject*) pCopyObj ), LIST_APPEND );
+ maList.push_back( new IMapRectangleObject( *(IMapRectangleObject*) pCopyObj ) );
break;
case( IMAP_OBJ_CIRCLE ):
- maList.Insert( new IMapCircleObject( *(IMapCircleObject*) pCopyObj ), LIST_APPEND );
+ maList.push_back( new IMapCircleObject( *(IMapCircleObject*) pCopyObj ) );
break;
case( IMAP_OBJ_POLYGON ):
- maList.Insert( new IMapPolygonObject( *(IMapPolygonObject*) pCopyObj ), LIST_APPEND );
+ maList.push_back( new IMapPolygonObject( *(IMapPolygonObject*) pCopyObj ) );
break;
default:
@@ -873,17 +843,17 @@ ImageMap& ImageMap::operator=( const ImageMap& rImageMap )
sal_Bool ImageMap::operator==( const ImageMap& rImageMap )
{
- const sal_uInt16 nCount = (sal_uInt16) maList.Count();
- const sal_uInt16 nEqCount = rImageMap.GetIMapObjectCount();
- sal_Bool bRet = sal_False;
+ const size_t nCount = maList.size();
+ const size_t nEqCount = rImageMap.GetIMapObjectCount();
+ sal_Bool bRet = sal_False;
if ( nCount == nEqCount )
{
sal_Bool bDifferent = ( aName != rImageMap.aName );
- for ( sal_uInt16 i = 0; ( i < nCount ) && !bDifferent; i++ )
+ for ( size_t i = 0; ( i < nCount ) && !bDifferent; i++ )
{
- IMapObject* pObj = (IMapObject*) maList.GetObject( i );
+ IMapObject* pObj = maList[ i ];
IMapObject* pEqObj = rImageMap.GetIMapObject( i );
if ( pObj->GetType() == pEqObj->GetType() )
@@ -962,15 +932,15 @@ void ImageMap::InsertIMapObject( const IMapObject& rIMapObject )
switch( rIMapObject.GetType() )
{
case( IMAP_OBJ_RECTANGLE ):
- maList.Insert( new IMapRectangleObject( (IMapRectangleObject&) rIMapObject ), LIST_APPEND );
+ maList.push_back( new IMapRectangleObject( (IMapRectangleObject&) rIMapObject ) );
break;
case( IMAP_OBJ_CIRCLE ):
- maList.Insert( new IMapCircleObject( (IMapCircleObject&) rIMapObject ), LIST_APPEND );
+ maList.push_back( new IMapCircleObject( (IMapCircleObject&) rIMapObject ) );
break;
case( IMAP_OBJ_POLYGON ):
- maList.Insert( new IMapPolygonObject( (IMapPolygonObject&) rIMapObject ), LIST_APPEND );
+ maList.push_back( new IMapPolygonObject( (IMapPolygonObject&) rIMapObject ) );
break;
default:
@@ -1005,13 +975,12 @@ IMapObject* ImageMap::GetHitIMapObject( const Size& rTotalSize,
}
// Alle Objekte durchlaufen und HitTest ausfuehren
- IMapObject* pObj = (IMapObject*) maList.First();
- while ( pObj )
- {
- if ( pObj->IsHit( aRelPoint ) )
+ IMapObject* pObj = NULL;
+ for( size_t i = 0, n = maList.size(); i < n; ++i ) {
+ if ( maList[ i ]->IsHit( aRelPoint ) ) {
+ pObj = maList[ i ];
break;
-
- pObj = (IMapObject*) maList.Next();
+ }
}
return( pObj ? ( pObj->IsActive() ? pObj : NULL ) : NULL );
@@ -1027,10 +996,10 @@ IMapObject* ImageMap::GetHitIMapObject( const Size& rTotalSize,
Rectangle ImageMap::GetBoundRect() const
{
Rectangle aBoundRect;
- sal_uLong nCount = maList.Count();
+ size_t nCount = maList.size();
- for ( sal_uLong i = 0; i < nCount; i++ )
- aBoundRect.Union( ( (IMapObject*) maList.GetObject( i ) )->GetBoundRect() );
+ for ( size_t i = 0; i < nCount; i++ )
+ aBoundRect.Union( maList[ i ]->GetBoundRect() );
return aBoundRect;
}
@@ -1044,11 +1013,11 @@ Rectangle ImageMap::GetBoundRect() const
void ImageMap::Scale( const Fraction& rFracX, const Fraction& rFracY )
{
- sal_uInt16 nCount = (sal_uInt16) maList.Count();
+ size_t nCount = maList.size();
- for ( sal_uInt16 i = 0; i < nCount; i++ )
+ for ( size_t i = 0; i < nCount; i++ )
{
- IMapObject* pObj = GetIMapObject( i );
+ IMapObject* pObj = maList[ i ];
switch( pObj->GetType() )
{
@@ -1080,11 +1049,11 @@ void ImageMap::Scale( const Fraction& rFracX, const Fraction& rFracY )
void ImageMap::ImpWriteImageMap( SvStream& rOStm, const String& rBaseURL ) const
{
IMapObject* pObj;
- sal_uInt16 nCount = (sal_uInt16) maList.Count();
+ size_t nCount = maList.size();
- for ( sal_uInt16 i = 0; i < nCount; i++ )
+ for ( size_t i = 0; i < nCount; i++ )
{
- pObj = (IMapObject*) maList.GetObject( i );
+ pObj = maList[ i ];
pObj->Write( rOStm, rBaseURL );
}
}
@@ -1096,10 +1065,10 @@ void ImageMap::ImpWriteImageMap( SvStream& rOStm, const String& rBaseURL ) const
|*
\******************************************************************************/
-void ImageMap::ImpReadImageMap( SvStream& rIStm, sal_uInt16 nCount, const String& rBaseURL )
+void ImageMap::ImpReadImageMap( SvStream& rIStm, size_t nCount, const String& rBaseURL )
{
// neue Objekte einlesen
- for ( sal_uInt16 i = 0; i < nCount; i++ )
+ for ( size_t i = 0; i < nCount; i++ )
{
sal_uInt16 nType;
@@ -1112,7 +1081,7 @@ void ImageMap::ImpReadImageMap( SvStream& rIStm, sal_uInt16 nCount, const String
{
IMapRectangleObject* pObj = new IMapRectangleObject;
pObj->Read( rIStm, rBaseURL );
- maList.Insert( pObj, LIST_APPEND );
+ maList.push_back( pObj );
}
break;
@@ -1120,7 +1089,7 @@ void ImageMap::ImpReadImageMap( SvStream& rIStm, sal_uInt16 nCount, const String
{
IMapCircleObject* pObj = new IMapCircleObject;
pObj->Read( rIStm, rBaseURL );
- maList.Insert( pObj, LIST_APPEND );
+ maList.push_back( pObj );
}
break;
@@ -1128,7 +1097,7 @@ void ImageMap::ImpReadImageMap( SvStream& rIStm, sal_uInt16 nCount, const String
{
IMapPolygonObject* pObj = new IMapPolygonObject;
pObj->Read( rIStm, rBaseURL );
- maList.Insert( pObj, LIST_APPEND );
+ maList.push_back( pObj );
}
break;
diff --git a/svtools/source/misc/imap2.cxx b/svtools/source/misc/imap2.cxx
index 20e8ae6431b8..359615a1b2c2 100644
--- a/svtools/source/misc/imap2.cxx
+++ b/svtools/source/misc/imap2.cxx
@@ -48,209 +48,111 @@
#define NOTEOL(c) ((c)!='\0')
-
TYPEINIT0_AUTOFACTORY( ImageMap );
-
-/******************************************************************************/
-/******************************************************************************/
-
-
-/******************************************************************************
-|*
-|*
-|*
-\******************************************************************************/
-
-void IMapObject::AppendCERNCoords( const Point& rPoint100, ByteString& rStr ) const
+void IMapObject::AppendCERNCoords(rtl::OStringBuffer& rBuf, const Point& rPoint100) const
{
const Point aPixPt( Application::GetDefaultDevice()->LogicToPixel( rPoint100, MapMode( MAP_100TH_MM ) ) );
- rStr += '(';
- rStr += ByteString::CreateFromInt32( aPixPt.X() );
- rStr += ',';
- rStr += ByteString::CreateFromInt32( aPixPt.Y() );
- rStr += ") ";
+ rBuf.append('(');
+ rBuf.append(static_cast<sal_Int32>(aPixPt.X()));
+ rBuf.append(',');
+ rBuf.append(static_cast<sal_Int32>(aPixPt.Y()));
+ rBuf.append(RTL_CONSTASCII_STRINGPARAM(") "));
}
-
-/******************************************************************************
-|*
-|*
-|*
-\******************************************************************************/
-
-void IMapObject::AppendNCSACoords( const Point& rPoint100, ByteString& rStr ) const
+void IMapObject::AppendNCSACoords(rtl::OStringBuffer& rBuf, const Point& rPoint100) const
{
const Point aPixPt( Application::GetDefaultDevice()->LogicToPixel( rPoint100, MapMode( MAP_100TH_MM ) ) );
- rStr += ByteString::CreateFromInt32( aPixPt.X() );
- rStr += ',';
- rStr += ByteString::CreateFromInt32( aPixPt.Y() );
- rStr += ' ';
+ rBuf.append(static_cast<sal_Int32>(aPixPt.X()));
+ rBuf.append(',');
+ rBuf.append(static_cast<sal_Int32>(aPixPt.Y()));
+ rBuf.append(' ');
}
-
-/******************************************************************************
-|*
-|*
-|*
-\******************************************************************************/
-
-void IMapObject::AppendCERNURL( ByteString& rStr, const String& rBaseURL ) const
+void IMapObject::AppendCERNURL(rtl::OStringBuffer& rBuf, const String& rBaseURL) const
{
- rStr += ByteString( String(URIHelper::simpleNormalizedMakeRelative( rBaseURL, aURL )), gsl_getSystemTextEncoding() );
+ rBuf.append(rtl::OUStringToOString(URIHelper::simpleNormalizedMakeRelative(rBaseURL, aURL), gsl_getSystemTextEncoding()));
}
-
-/******************************************************************************
-|*
-|*
-|*
-\******************************************************************************/
-
-void IMapObject::AppendNCSAURL( ByteString& rStr, const String& rBaseURL ) const
+void IMapObject::AppendNCSAURL(rtl::OStringBuffer& rBuf, const String& rBaseURL) const
{
- rStr += ByteString( String(URIHelper::simpleNormalizedMakeRelative( rBaseURL, aURL )), gsl_getSystemTextEncoding() );
- rStr += ' ';
+ rBuf.append(rtl::OUStringToOString(URIHelper::simpleNormalizedMakeRelative(rBaseURL, aURL), gsl_getSystemTextEncoding()));
+ rBuf.append(' ');
}
-
-/******************************************************************************/
-/******************************************************************************/
-
-
-/******************************************************************************
-|*
-|*
-|*
-\******************************************************************************/
-
void IMapRectangleObject::WriteCERN( SvStream& rOStm, const String& rBaseURL ) const
{
- ByteString aStr( "rectangle " );
+ rtl::OStringBuffer aStrBuf(RTL_CONSTASCII_STRINGPARAM("rectangle "));
- AppendCERNCoords( aRect.TopLeft(), aStr );
- AppendCERNCoords( aRect.BottomRight(), aStr );
- AppendCERNURL( aStr, rBaseURL );
+ AppendCERNCoords(aStrBuf, aRect.TopLeft());
+ AppendCERNCoords(aStrBuf, aRect.BottomRight());
+ AppendCERNURL(aStrBuf, rBaseURL);
- rOStm.WriteLine( aStr );
+ rOStm.WriteLine(aStrBuf.makeStringAndClear());
}
-
-/******************************************************************************
-|*
-|*
-|*
-\******************************************************************************/
-
void IMapRectangleObject::WriteNCSA( SvStream& rOStm, const String& rBaseURL ) const
{
- ByteString aStr( "rect " );
+ rtl::OStringBuffer aStrBuf(RTL_CONSTASCII_STRINGPARAM("rect "));
- AppendNCSAURL( aStr, rBaseURL );
- AppendNCSACoords( aRect.TopLeft(), aStr );
- AppendNCSACoords( aRect.BottomRight(), aStr );
+ AppendNCSAURL(aStrBuf, rBaseURL);
+ AppendNCSACoords(aStrBuf, aRect.TopLeft());
+ AppendNCSACoords(aStrBuf, aRect.BottomRight());
- rOStm.WriteLine( aStr );
+ rOStm.WriteLine(aStrBuf.makeStringAndClear());
}
-
-/******************************************************************************/
-/******************************************************************************/
-
-
-/******************************************************************************
-|*
-|*
-|*
-\******************************************************************************/
-
void IMapCircleObject::WriteCERN( SvStream& rOStm, const String& rBaseURL ) const
{
- ByteString aStr( "circle " );
+ rtl::OStringBuffer aStrBuf(RTL_CONSTASCII_STRINGPARAM("circle "));
- AppendCERNCoords( aCenter, aStr );
- aStr += ByteString::CreateFromInt32(nRadius);
- aStr += ' ';
- AppendCERNURL( aStr, rBaseURL );
+ AppendCERNCoords(aStrBuf, aCenter);
+ aStrBuf.append(nRadius);
+ aStrBuf.append(' ');
+ AppendCERNURL(aStrBuf, rBaseURL);
- rOStm.WriteLine( aStr );
+ rOStm.WriteLine(aStrBuf.makeStringAndClear());
}
-
-/******************************************************************************
-|*
-|*
-|*
-\******************************************************************************/
-
void IMapCircleObject::WriteNCSA( SvStream& rOStm, const String& rBaseURL ) const
{
- ByteString aStr( "circle " );
+ rtl::OStringBuffer aStrBuf(RTL_CONSTASCII_STRINGPARAM("circle "));
- AppendNCSAURL( aStr, rBaseURL );
- AppendNCSACoords( aCenter, aStr );
- AppendNCSACoords( aCenter + Point( nRadius, 0 ), aStr );
+ AppendNCSAURL(aStrBuf, rBaseURL);
+ AppendNCSACoords(aStrBuf, aCenter);
+ AppendNCSACoords(aStrBuf, aCenter + Point(nRadius, 0));
- rOStm.WriteLine( aStr );
+ rOStm.WriteLine(aStrBuf.makeStringAndClear());
}
-
-/******************************************************************************/
-/******************************************************************************/
-
-
-/******************************************************************************
-|*
-|*
-|*
-\******************************************************************************/
-
void IMapPolygonObject::WriteCERN( SvStream& rOStm, const String& rBaseURL ) const
{
- ByteString aStr( "polygon " );
- const sal_uInt16 nCount = aPoly.GetSize();
+ rtl::OStringBuffer aStrBuf(RTL_CONSTASCII_STRINGPARAM("polygon "));
+ const sal_uInt16 nCount = aPoly.GetSize();
- for ( sal_uInt16 i = 0; i < nCount; i++ )
- AppendCERNCoords( aPoly[ i ], aStr );
+ for (sal_uInt16 i = 0; i < nCount; ++i)
+ AppendCERNCoords(aStrBuf, aPoly[i]);
- AppendCERNURL( aStr, rBaseURL );
+ AppendCERNURL(aStrBuf, rBaseURL);
- rOStm.WriteLine( aStr );
+ rOStm.WriteLine(aStrBuf.makeStringAndClear());
}
-
-/******************************************************************************
-|*
-|*
-|*
-\******************************************************************************/
-
void IMapPolygonObject::WriteNCSA( SvStream& rOStm, const String& rBaseURL ) const
{
- ByteString aStr( "poly " );
- const sal_uInt16 nCount = Min( aPoly.GetSize(), (sal_uInt16) 100 );
+ rtl::OStringBuffer aStrBuf(RTL_CONSTASCII_STRINGPARAM("poly "));
+ const sal_uInt16 nCount = Min( aPoly.GetSize(), (sal_uInt16) 100 );
- AppendNCSAURL( aStr, rBaseURL );
+ AppendNCSAURL(aStrBuf, rBaseURL);
- for ( sal_uInt16 i = 0; i < nCount; i++ )
- AppendNCSACoords( aPoly[ i ], aStr );
+ for (sal_uInt16 i = 0; i < nCount; ++i)
+ AppendNCSACoords(aStrBuf, aPoly[i]);
- rOStm.WriteLine( aStr );
+ rOStm.WriteLine(aStrBuf.makeStringAndClear());
}
-
-/******************************************************************************/
-/******************************************************************************/
-
-
-/******************************************************************************
-|*
-|*
-|*
-\******************************************************************************/
-
void ImageMap::Write( SvStream& rOStm, sal_uLong nFormat, const String& rBaseURL ) const
{
switch( nFormat )
@@ -264,21 +166,14 @@ void ImageMap::Write( SvStream& rOStm, sal_uLong nFormat, const String& rBaseURL
}
}
-
-/******************************************************************************
-|*
-|*
-|*
-\******************************************************************************/
-
void ImageMap::ImpWriteCERN( SvStream& rOStm, const String& rBaseURL ) const
{
IMapObject* pObj;
- sal_uInt16 nCount = (sal_uInt16) maList.Count();
+ size_t nCount = maList.size();
- for ( sal_uInt16 i = 0; i < nCount; i++ )
+ for ( size_t i = 0; i < nCount; i++ )
{
- pObj = GetIMapObject( i );
+ pObj = maList[ i ];
switch( pObj->GetType() )
{
@@ -300,23 +195,16 @@ void ImageMap::ImpWriteCERN( SvStream& rOStm, const String& rBaseURL ) const
}
}
-
-/******************************************************************************
-|*
-|*
-|*
-\******************************************************************************/
-
void ImageMap::ImpWriteNCSA( SvStream& rOStm, const String& rBaseURL ) const
{
IMapObject* pObj;
- sal_uInt16 nCount = (sal_uInt16) maList.Count();
+ size_t nCount = maList.size();
- for ( sal_uInt16 i = 0; i < nCount; i++ )
+ for ( size_t i = 0; i < nCount; i++ )
{
- pObj = GetIMapObject( i );
+ pObj = maList[ i ];
- switch( pObj->GetType() )
+ switch( pObj->GetType() )
{
case( IMAP_OBJ_RECTANGLE ):
( (IMapRectangleObject*) pObj )->WriteNCSA( rOStm, rBaseURL );
@@ -336,13 +224,6 @@ void ImageMap::ImpWriteNCSA( SvStream& rOStm, const String& rBaseURL ) const
}
}
-
-/******************************************************************************
-|*
-|*
-|*
-\******************************************************************************/
-
sal_uLong ImageMap::Read( SvStream& rIStm, sal_uLong nFormat, const String& rBaseURL )
{
sal_uLong nRet = IMAP_ERR_FORMAT;
@@ -366,13 +247,6 @@ sal_uLong ImageMap::Read( SvStream& rIStm, sal_uLong nFormat, const String& rBas
return nRet;
}
-
-/******************************************************************************
-|*
-|*
-|*
-\******************************************************************************/
-
sal_uLong ImageMap::ImpReadCERN( SvStream& rIStm, const String& rBaseURL )
{
ByteString aStr;
@@ -386,13 +260,6 @@ sal_uLong ImageMap::ImpReadCERN( SvStream& rIStm, const String& rBaseURL )
return IMAP_ERR_OK;
}
-
-/******************************************************************************
-|*
-|*
-|*
-\******************************************************************************/
-
void ImageMap::ImpReadCERNLine( const ByteString& rLine, const String& rBaseURL )
{
ByteString aStr( rLine );
@@ -423,7 +290,7 @@ void ImageMap::ImpReadCERNLine( const ByteString& rLine, const String& rBaseURL
const Rectangle aRect( aTopLeft, aBottomRight );
IMapRectangleObject* pObj = new IMapRectangleObject( aRect, aURL, String(), String(), String(), String() );
- maList.Insert( pObj, LIST_APPEND );
+ maList.push_back( pObj );
}
else if ( ( aToken == "circle" ) || ( aToken == "circ" ) )
{
@@ -432,7 +299,7 @@ void ImageMap::ImpReadCERNLine( const ByteString& rLine, const String& rBaseURL
const String aURL( ImpReadCERNURL( &pStr, rBaseURL ) );
IMapCircleObject* pObj = new IMapCircleObject( aCenter, nRadius, aURL, String(), String(), String(), String() );
- maList.Insert( pObj, LIST_APPEND );
+ maList.push_back( pObj );
}
else if ( ( aToken == "polygon" ) || ( aToken == "poly" ) )
{
@@ -446,18 +313,11 @@ void ImageMap::ImpReadCERNLine( const ByteString& rLine, const String& rBaseURL
aURL = ImpReadCERNURL( &pStr, rBaseURL );
IMapPolygonObject* pObj = new IMapPolygonObject( aPoly, aURL, String(), String(), String(), String() );
- maList.Insert( pObj, LIST_APPEND );
+ maList.push_back( pObj );
}
}
}
-
-/******************************************************************************
-|*
-|*
-|*
-\******************************************************************************/
-
Point ImageMap::ImpReadCERNCoords( const char** ppStr )
{
String aStrX;
@@ -498,13 +358,6 @@ Point ImageMap::ImpReadCERNCoords( const char** ppStr )
return aPt;
}
-
-/******************************************************************************
-|*
-|*
-|*
-\******************************************************************************/
-
long ImageMap::ImpReadCERNRadius( const char** ppStr )
{
String aStr;
@@ -525,13 +378,6 @@ long ImageMap::ImpReadCERNRadius( const char** ppStr )
return aStr.ToInt32();
}
-
-/******************************************************************************
-|*
-|*
-|*
-\******************************************************************************/
-
String ImageMap::ImpReadCERNURL( const char** ppStr, const String& rBaseURL )
{
String aStr( String::CreateFromAscii( *ppStr ) );
@@ -544,13 +390,6 @@ String ImageMap::ImpReadCERNURL( const char** ppStr, const String& rBaseURL )
return INetURLObject::GetAbsURL( rBaseURL, aStr );
}
-
-/******************************************************************************
-|*
-|*
-|*
-\******************************************************************************/
-
sal_uLong ImageMap::ImpReadNCSA( SvStream& rIStm, const String& rBaseURL )
{
ByteString aStr;
@@ -564,13 +403,6 @@ sal_uLong ImageMap::ImpReadNCSA( SvStream& rIStm, const String& rBaseURL )
return IMAP_ERR_OK;
}
-
-/******************************************************************************
-|*
-|*
-|*
-\******************************************************************************/
-
void ImageMap::ImpReadNCSALine( const ByteString& rLine, const String& rBaseURL )
{
ByteString aStr( rLine );
@@ -601,7 +433,7 @@ void ImageMap::ImpReadNCSALine( const ByteString& rLine, const String& rBaseURL
const Rectangle aRect( aTopLeft, aBottomRight );
IMapRectangleObject* pObj = new IMapRectangleObject( aRect, aURL, String(), String(), String(), String() );
- maList.Insert( pObj, LIST_APPEND );
+ maList.push_back( pObj );
}
else if ( aToken == "circle" )
{
@@ -612,7 +444,7 @@ void ImageMap::ImpReadNCSALine( const ByteString& rLine, const String& rBaseURL
(double) aDX.Y() * aDX.Y() );
IMapCircleObject* pObj = new IMapCircleObject( aCenter, nRadius, aURL, String(), String(), String(), String() );
- maList.Insert( pObj, LIST_APPEND );
+ maList.push_back( pObj );
}
else if ( aToken == "poly" )
{
@@ -624,18 +456,11 @@ void ImageMap::ImpReadNCSALine( const ByteString& rLine, const String& rBaseURL
aPoly[ i ] = ImpReadNCSACoords( &pStr );
IMapPolygonObject* pObj = new IMapPolygonObject( aPoly, aURL, String(), String(), String(), String() );
- maList.Insert( pObj, LIST_APPEND );
+ maList.push_back( pObj );
}
}
}
-
-/******************************************************************************
-|*
-|*
-|*
-\******************************************************************************/
-
String ImageMap::ImpReadNCSAURL( const char** ppStr, const String& rBaseURL )
{
String aStr;
@@ -656,13 +481,6 @@ String ImageMap::ImpReadNCSAURL( const char** ppStr, const String& rBaseURL )
return INetURLObject::GetAbsURL( rBaseURL, aStr );
}
-
-/******************************************************************************
-|*
-|*
-|*
-\******************************************************************************/
-
Point ImageMap::ImpReadNCSACoords( const char** ppStr )
{
String aStrX;
@@ -699,13 +517,6 @@ Point ImageMap::ImpReadNCSACoords( const char** ppStr )
return aPt;
}
-
-/******************************************************************************
-|*
-|*
-|*
-\******************************************************************************/
-
sal_uLong ImageMap::ImpDetectFormat( SvStream& rIStm )
{
sal_uLong nPos = rIStm.Tell();
diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx
index 4b24ed4330fd..cbb5eedb3bb3 100644
--- a/svtools/source/misc/transfer.cxx
+++ b/svtools/source/misc/transfer.cxx
@@ -65,6 +65,7 @@
#include <svtools/wmf.hxx>
#include <svtools/imap.hxx>
#include <svtools/transfer.hxx>
+#include <rtl/strbuf.hxx>
#include <cstdio>
// --------------
@@ -879,15 +880,16 @@ sal_Bool TransferableHelper::SetINetBookmark( const INetBookmark& rBmk,
{
case( SOT_FORMATSTR_ID_SOLK ):
{
- ByteString sURL( rBmk.GetURL(), eSysCSet ),
- sDesc( rBmk.GetDescription(), eSysCSet );
- ByteString sOut( ByteString::CreateFromInt32( sURL.Len() ));
- ( sOut += '@' ) += sURL;
- sOut += ByteString::CreateFromInt32( sDesc.Len() );
- ( sOut += '@' ) += sDesc;
-
- Sequence< sal_Int8 > aSeq( sOut.Len() );
- memcpy( aSeq.getArray(), sOut.GetBuffer(), sOut.Len() );
+ rtl::OString sURL(rtl::OUStringToOString(rBmk.GetURL(), eSysCSet));
+ rtl::OString sDesc(rtl::OUStringToOString(rBmk.GetDescription(), eSysCSet));
+ rtl::OStringBuffer sOut;
+ sOut.append(sURL.getLength());
+ sOut.append('@').append(sURL);
+ sOut.append(sDesc.getLength());
+ sOut.append('@').append(sDesc);
+
+ Sequence< sal_Int8 > aSeq(sOut.getLength());
+ memcpy(aSeq.getArray(), sOut.getStr(), sOut.getLength());
maAny <<= aSeq;
}
break;
@@ -973,22 +975,6 @@ sal_Bool TransferableHelper::SetINetImage( const INetImage& rINtImg,
// -----------------------------------------------------------------------------
-sal_Bool TransferableHelper::SetFileList( const FileList& rFileList,
- const ::com::sun::star::datatransfer::DataFlavor& )
-{
- SvMemoryStream aMemStm( 4096, 4096 );
-
- aMemStm.SetVersion( SOFFICE_FILEFORMAT_50 );
- aMemStm << rFileList;
-
- maAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ),
- aMemStm.Seek( STREAM_SEEK_TO_END ) );
-
- return( maAny.hasValue() );
-}
-
-// -----------------------------------------------------------------------------
-
sal_Bool TransferableHelper::SetObject( void* pUserObject, sal_uInt32 nUserObjectId, const DataFlavor& rFlavor )
{
SotStorageStreamRef xStm( new SotStorageStream( String() ) );
@@ -1020,15 +1006,6 @@ sal_Bool TransferableHelper::SetObject( void* pUserObject, sal_uInt32 nUserObjec
// -----------------------------------------------------------------------------
-sal_Bool TransferableHelper::SetInterface( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rIf,
- const ::com::sun::star::datatransfer::DataFlavor& )
-{
- maAny <<= rIf;
- return( maAny.hasValue() );
-}
-
-// -----------------------------------------------------------------------------
-
sal_Bool TransferableHelper::WriteObject( SotStorageStreamRef&, void*, sal_uInt32, const DataFlavor& )
{
OSL_FAIL( "TransferableHelper::WriteObject( ... ) not implemented" );
@@ -2212,15 +2189,6 @@ sal_Bool TransferableDataHelper::GetInputStream( const DataFlavor& rFlavor, Refe
// -----------------------------------------------------------------------------
-
-sal_Bool TransferableDataHelper::GetInterface( SotFormatStringId nFormat, Reference< XInterface >& rIf )
-{
- DataFlavor aFlavor;
- return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetInterface( aFlavor, rIf ) );
-}
-
-// -----------------------------------------------------------------------------
-
sal_Bool TransferableDataHelper::GetInterface( const DataFlavor& rFlavor, Reference< XInterface >& rIf )
{
const Any aAny( GetAny( rFlavor ) );
diff --git a/svtools/source/misc/transfer2.cxx b/svtools/source/misc/transfer2.cxx
index 5e4fa8e56077..fe8921061f8f 100644
--- a/svtools/source/misc/transfer2.cxx
+++ b/svtools/source/misc/transfer2.cxx
@@ -475,15 +475,6 @@ sal_Bool TransferDataContainer::GetData( const
// -----------------------------------------------------------------------------
-void TransferDataContainer::ClearData()
-{
- delete pImpl;
- pImpl = new TransferDataContainer_Impl;
- ClearFormats();
-}
-
-// -----------------------------------------------------------------------------
-
void TransferDataContainer::CopyINetBookmark( const INetBookmark& rBkmk )
{
if( !pImpl->pBookmk )
diff --git a/svtools/source/misc/unitconv.cxx b/svtools/source/misc/unitconv.cxx
index 17adaeaecd81..189c7e24e4bb 100644
--- a/svtools/source/misc/unitconv.cxx
+++ b/svtools/source/misc/unitconv.cxx
@@ -293,64 +293,6 @@ FieldUnit MapToFieldUnit( const SfxMapUnit eUnit )
// -----------------------------------------------------------------------
-MapUnit FieldToMapUnit( const SfxFieldUnit /*eUnit*/ )
-{
- return MAP_APPFONT;
-}
-
-// -----------------------------------------------------------------------
-
-long ConvertValueToMap( long nVal, SfxMapUnit eUnit )
-{
- long nNew = nVal;
-
- switch ( eUnit )
- {
- case SFX_MAPUNIT_10TH_MM:
- case SFX_MAPUNIT_10TH_INCH:
- nNew *= 10;
- break;
-
- case SFX_MAPUNIT_100TH_MM:
- case SFX_MAPUNIT_100TH_INCH:
- nNew *= 100;
- break;
-
- case SFX_MAPUNIT_1000TH_INCH:
- nNew *= 1000;
- default: ;//prevent warning
- }
- return nNew;
-}
-
-// -----------------------------------------------------------------------
-
-long ConvertValueToUnit( long nVal, SfxMapUnit eUnit )
-{
- long nNew = nVal;
-
- switch ( eUnit )
- {
- case SFX_MAPUNIT_10TH_MM:
- case SFX_MAPUNIT_10TH_INCH:
- nNew /= 10;
- break;
-
- case SFX_MAPUNIT_100TH_MM:
- case SFX_MAPUNIT_100TH_INCH:
- nNew /= 100;
- break;
-
- case SFX_MAPUNIT_1000TH_INCH:
- nNew /= 1000;
- break;
- default: ;//prevent warning
- }
- return nNew;
-}
-
-// -----------------------------------------------------------------------
-
long CalcToPoint( long nIn, SfxMapUnit eUnit, sal_uInt16 nFaktor )
{
DBG_ASSERT( eUnit == SFX_MAPUNIT_TWIP ||
diff --git a/svtools/source/productregistration/productregistration.cxx b/svtools/source/productregistration/productregistration.cxx
index a4251652aac2..a3312c107a52 100644
--- a/svtools/source/productregistration/productregistration.cxx
+++ b/svtools/source/productregistration/productregistration.cxx
@@ -453,13 +453,7 @@ namespace svt
extern "C"
{
-SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment (
- const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */)
-{
- *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
-}
-
-SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory (
+SAL_DLLPUBLIC_EXPORT void * SAL_CALL productregistration_component_getFactory (
const sal_Char * pImplementationName, void * pServiceManager, void * /* pRegistryKey */)
{
void * pResult = 0;
diff --git a/svtools/source/productregistration/productregistration.uno.component b/svtools/source/productregistration/productregistration.uno.component
index da2cfd37c483..f57860ef6463 100644
--- a/svtools/source/productregistration/productregistration.uno.component
+++ b/svtools/source/productregistration/productregistration.uno.component
@@ -26,7 +26,7 @@
*
**********************************************************************-->
-<component loader="com.sun.star.loader.SharedLibrary"
+<component loader="com.sun.star.loader.SharedLibrary" prefix="productregistration"
xmlns="http://openoffice.org/2010/uno-components">
<implementation name="com.sun.star.comp.setup.ProductRegistration">
<service name="com.sun.star.setup.ProductRegistration"/>
diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx
index 31e60e1ab1a1..f1d56f7f6fc5 100644
--- a/svtools/source/svhtml/htmlout.cxx
+++ b/svtools/source/svhtml/htmlout.cxx
@@ -485,7 +485,7 @@ void lcl_ConvertCharToHTML( sal_Unicode c, ByteString& rDest,
rDest += *pBuffer++;
(((rDest += '&') += '#') +=
- ByteString::CreateFromInt64( (sal_uInt32)c )) += ';';
+ ByteString(rtl::OString::valueOf(static_cast<sal_Int64>(c)))) += ';';
if( pNonConvertableChars &&
STRING_NOTFOUND == pNonConvertableChars->Search( c ) )
pNonConvertableChars->Append( c );
@@ -658,11 +658,16 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream,
(const IMapRectangleObject *)pObj;
pShape = OOO_STRING_SVTOOLS_HTML_SH_rect;
Rectangle aRect( pRectObj->GetRectangle() );
- ((((((aCoords =
- ByteString::CreateFromInt32(aRect.Left())) += ',')
- += ByteString::CreateFromInt32(aRect.Top())) += ',')
- += ByteString::CreateFromInt32(aRect.Right())) += ',')
- += ByteString::CreateFromInt32(aRect.Bottom());
+
+ aCoords = rtl::OStringBuffer()
+ .append(static_cast<sal_Int32>(aRect.Left()))
+ .append(',')
+ .append(static_cast<sal_Int32>(aRect.Top()))
+ .append(',')
+ .append(static_cast<sal_Int32>(aRect.Right()))
+ .append(',')
+ .append(static_cast<sal_Int32>(aRect.Bottom()))
+ .makeStringAndClear();
}
break;
case( IMAP_OBJ_CIRCLE ):
@@ -672,10 +677,14 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream,
pShape= OOO_STRING_SVTOOLS_HTML_SH_circ;
Point aCenter( pCirc->GetCenter() );
long nOff = pCirc->GetRadius();
- ((((aCoords =
- ByteString::CreateFromInt32(aCenter.X())) += ',')
- += ByteString::CreateFromInt32(aCenter.Y())) += ',')
- += ByteString::CreateFromInt32(nOff);
+
+ aCoords = rtl::OStringBuffer()
+ .append(static_cast<sal_Int32>(aCenter.X()))
+ .append(',')
+ .append(static_cast<sal_Int32>(aCenter.Y()))
+ .append(',')
+ .append(static_cast<sal_Int32>(nOff))
+ .makeStringAndClear();
}
break;
case( IMAP_OBJ_POLYGON ):
@@ -685,20 +694,23 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream,
pShape= OOO_STRING_SVTOOLS_HTML_SH_poly;
Polygon aPoly( pPolyObj->GetPolygon() );
sal_uInt16 nCount = aPoly.GetSize();
+ rtl::OStringBuffer aTmpBuf;
if( nCount>0 )
{
const Point& rPoint = aPoly[0];
- ((aCoords =
- ByteString::CreateFromInt32(rPoint.X())) += ',')
- += ByteString::CreateFromInt32(rPoint.Y());
+ aTmpBuf.append(static_cast<sal_Int32>(rPoint.X()))
+ .append(',')
+ .append(static_cast<sal_Int32>(rPoint.Y()));
}
for( sal_uInt16 j=1; j<nCount; j++ )
{
const Point& rPoint = aPoly[j];
- (((aCoords += ',')
- += ByteString::CreateFromInt32(rPoint.X())) += ',')
- += ByteString::CreateFromInt32(rPoint.Y());
+ aTmpBuf.append(',')
+ .append(static_cast<sal_Int32>(rPoint.X()))
+ .append(',')
+ .append(static_cast<sal_Int32>(rPoint.Y()));
}
+ aCoords = aTmpBuf.makeStringAndClear();
}
break;
default:
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index 8cf6f406e2bd..b431d0d931c7 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -2266,11 +2266,10 @@ bool HTMLParser::ParseMetaOptions(
rtl_TextEncoding HTMLParser::GetEncodingByMIME( const String& rMime )
{
- ByteString sType;
- ByteString sSubType;
+ String sType;
+ String sSubType;
INetContentTypeParameterList aParameters;
- ByteString sMime( rMime, RTL_TEXTENCODING_ASCII_US );
- if (INetContentTypes::parse(sMime, sType, sSubType, &aParameters))
+ if (INetContentTypes::parse(rMime, sType, sSubType, &aParameters))
{
const INetContentTypeParameter * pCharset
= aParameters.find("charset");
diff --git a/svtools/source/svrtf/parrtf.cxx b/svtools/source/svrtf/parrtf.cxx
index a475343dcaac..5a04328045c6 100644
--- a/svtools/source/svrtf/parrtf.cxx
+++ b/svtools/source/svrtf/parrtf.cxx
@@ -341,7 +341,27 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak )
ByteString aByteString;
while (1)
{
- aByteString.Append((char)GetHexValue());
+ char c = (char)GetHexValue();
+
+ if (c)
+ {
+ aByteString.Append(c);
+ }
+ else
+ {
+ /* \'00 is a valid internal character in a
+ * string in RTF, however ByteString::Append
+ * does nothing if '\0' is passed in. It is
+ * otherwise capable of handling strings with
+ * embedded NULs, so add a '\1' and then
+ * change it, as ByteString::SetChar does not
+ * care if the character is '\0'.
+ */
+ int nLen = aByteString.Len();
+
+ aByteString.Append('\001');
+ aByteString.SetChar(nLen, '\0');
+ }
bool bBreak = false;
sal_Char nSlash = '\\';
diff --git a/svtools/source/svrtf/rtfout.cxx b/svtools/source/svrtf/rtfout.cxx
index 21368c0b14d3..065fc6ba5572 100644
--- a/svtools/source/svrtf/rtfout.cxx
+++ b/svtools/source/svrtf/rtfout.cxx
@@ -141,11 +141,15 @@ SvStream& RTFOutFuncs::Out_Char(SvStream& rStream, sal_Unicode c,
// then write as unicode - character
if (*pUCMode != nLen)
{
- rStream << "\\uc" << ByteString::CreateFromInt32(nLen).GetBuffer() << " "; // #i47831# add an additional whitespace, so that "document whitespaces" are not ignored.;
+ // #i47831# add an additional whitespace, so that
+ // "document whitespaces" are not ignored.;
+ rStream << "\\uc"
+ << rtl::OString::valueOf(nLen).getStr() << " ";
*pUCMode = nLen;
}
- ByteString sNo(ByteString::CreateFromInt32(c));
- rStream << "\\u" << sNo.GetBuffer();
+ rStream << "\\u"
+ << rtl::OString::valueOf(
+ static_cast<sal_Int32>(c)).getStr();
}
for (sal_Int32 nI = 0; nI < nLen; ++nI)
@@ -176,17 +180,6 @@ SvStream& RTFOutFuncs::Out_String( SvStream& rStream, const String& rStr,
return rStream;
}
-SvStream& RTFOutFuncs::Out_Fontname(SvStream& rStream, const String& rStr,
- rtl_TextEncoding eDestEnc, sal_Bool bWriteHelpFile)
-{
- //Fontnames in word have a quirk in that \uc and usage of ansi replacement
- //chars after a \u don't work and in wordpad \u doesn't work, so we are
- //left with forcing ansi characters only for fontnames
- for (xub_StrLen n = 0; n < rStr.Len(); ++n)
- Out_Char(rStream, rStr.GetChar(n), 0, eDestEnc, bWriteHelpFile);
- return rStream;
-}
-
SvStream& RTFOutFuncs::Out_Hex( SvStream& rStream, sal_uLong nHex, sal_uInt8 nLen )
{
sal_Char aNToABuf[] = "0000000000000000";
diff --git a/svtools/source/uno/miscservices.cxx b/svtools/source/uno/miscservices.cxx
index c652b6028bf0..e49672bbac52 100644
--- a/svtools/source/uno/miscservices.cxx
+++ b/svtools/source/uno/miscservices.cxx
@@ -96,13 +96,7 @@ DECLARE_CREATEINSTANCE_NAMESPACE( unographic, GraphicRendererVCL )
extern "C"
{
-SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment (
- const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */)
-{
- *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
-}
-
-SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory (
+SAL_DLLPUBLIC_EXPORT void * SAL_CALL svt_component_getFactory (
const sal_Char * pImplementationName, void * _pServiceManager, void * pRegistryKey)
{
void * pResult = 0;
diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx
index d2cf9cbf12cf..4bc5cae12cb6 100644
--- a/svtools/source/uno/unoiface.cxx
+++ b/svtools/source/uno/unoiface.cxx
@@ -34,7 +34,6 @@
#include <vcl/svapp.hxx>
#include <svtools/svmedit.hxx>
#include <unoiface.hxx>
-#include <svtools/filedlg.hxx>
#include <svtools/filectrl.hxx>
#include <svtools/roadmap.hxx>
#include <svtools/fixedhyper.hxx>