fix: #85201# new template dialog
This commit is contained in:
@@ -0,0 +1,779 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: fileview.cxx,v $
|
||||
*
|
||||
* $Revision: 1.1 $
|
||||
*
|
||||
* last change: $Author: pb $ $Date: 2001-05-07 10:33:55 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1
|
||||
* - Sun Industry Standards Source License Version 1.1
|
||||
*
|
||||
* Sun Microsystems Inc., October, 2000
|
||||
*
|
||||
* GNU Lesser General Public License Version 2.1
|
||||
* =============================================
|
||||
* Copyright 2000 by Sun Microsystems, Inc.
|
||||
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library 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 for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Sun Industry Standards Source License Version 1.1
|
||||
* =================================================
|
||||
* The contents of this file are subject to the Sun Industry Standards
|
||||
* Source License Version 1.1 (the "License"); You may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of the
|
||||
* License at http://www.openoffice.org/license.html.
|
||||
*
|
||||
* Software provided under this License is provided on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||
* See the License for the specific provisions governing your rights and
|
||||
* obligations concerning the Software.
|
||||
*
|
||||
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||
*
|
||||
* Copyright: 2000 by Sun Microsystems, Inc.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): _______________________________________
|
||||
*
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#include "fileview.hxx"
|
||||
#include "svtdata.hxx"
|
||||
#include "imagemgr.hxx"
|
||||
|
||||
#include "svtools.hrc"
|
||||
|
||||
#ifndef _COM_SUN_STAR_UTIL_DATETIME_HPP_
|
||||
#include <com/sun/star/util/DateTime.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
|
||||
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP_
|
||||
#include <com/sun/star/task/XInteractionHandler.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_UCB_XPROGRESSHANDLER_HPP_
|
||||
#include <com/sun/star/ucb/XProgressHandler.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_
|
||||
#include <com/sun/star/sdbc/XResultSet.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_UCB_XANYCOMPAREFACTORY_HPP_
|
||||
#include <com/sun/star/ucb/XAnyCompareFactory.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_UCB_XCONTENTACCESS_HPP_
|
||||
#include <com/sun/star/ucb/XContentAccess.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_UCB_XDYNAMICRESULTSET_HPP_
|
||||
#include <com/sun/star/ucb/XDynamicResultSet.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_UCB_XSORTEDDYNAMICRESULTSETFACTORY_HPP_
|
||||
#include <com/sun/star/ucb/XSortedDynamicResultSetFactory.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
|
||||
#include <com/sun/star/sdbc/XRow.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_
|
||||
#include <com/sun/star/container/XChild.hpp>
|
||||
#endif
|
||||
|
||||
#include <tools/urlobj.hxx>
|
||||
#include <tools/datetime.hxx>
|
||||
#include <svtools/headbar.hxx>
|
||||
#include <svtools/svtabbx.hxx>
|
||||
#include <comphelper/processfactory.hxx>
|
||||
#include <unotools/localfilehelper.hxx>
|
||||
#include <ucbhelper/content.hxx>
|
||||
#include <ucbhelper/commandenvironment.hxx>
|
||||
|
||||
#ifndef _BIGINT_HXX
|
||||
#include <tools/bigint.hxx>
|
||||
#endif
|
||||
#ifndef _SV_MSGBOX_HXX
|
||||
#include <vcl/msgbox.hxx>
|
||||
#endif
|
||||
#ifndef _TOOLS_SOLMATH_HXX
|
||||
#include <tools/solmath.hxx>
|
||||
#endif
|
||||
#ifndef _SV_SVAPP_HXX
|
||||
#include <vcl/svapp.hxx>
|
||||
#endif
|
||||
#ifndef _UNOTOOLS_UCBHELPER_HXX
|
||||
#include <unotools/ucbhelper.hxx>
|
||||
#endif
|
||||
#ifndef _UNOTOOLS_LOCALEDATAWRAPPER_HXX
|
||||
#include <unotools/localedatawrapper.hxx>
|
||||
#endif
|
||||
|
||||
using namespace ::com::sun::star::lang;
|
||||
using namespace ::com::sun::star::sdbc;
|
||||
using namespace ::com::sun::star::task;
|
||||
using namespace ::com::sun::star::ucb;
|
||||
using namespace ::com::sun::star::uno;
|
||||
using namespace ::comphelper;
|
||||
using namespace ::rtl;
|
||||
using namespace ::ucb;
|
||||
|
||||
DECLARE_LIST( StringList_Impl, OUString* );
|
||||
|
||||
#define ROW_HEIGHT 17 // the height of a row has to be a little higher than the bitmap
|
||||
|
||||
// functions -------------------------------------------------------------
|
||||
|
||||
#define CONVERT_DATETIME( aUnoDT, aToolsDT ) \
|
||||
aToolsDT = DateTime( Date( aUnoDT.Day, aUnoDT.Month, aUnoDT.Year ), \
|
||||
Time( aUnoDT.Hours, aUnoDT.Minutes, aUnoDT.Seconds, aUnoDT.HundredthSeconds ) );
|
||||
|
||||
void AppendDateTime_Impl( const ::com::sun::star::util::DateTime& rDT,
|
||||
const ::com::sun::star::lang::Locale& rLocale, String& rRow )
|
||||
{
|
||||
DateTime aDT;
|
||||
CONVERT_DATETIME( rDT, aDT );
|
||||
LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), rLocale );
|
||||
String aDateStr = aLocaleWrapper.getDate( aDT );
|
||||
aDateStr += String::CreateFromAscii( ", " );
|
||||
aDateStr += aLocaleWrapper.getTime( aDT );
|
||||
rRow += aDateStr;
|
||||
}
|
||||
|
||||
String CreateExactSizeText_Impl( ULONG nSize )
|
||||
{
|
||||
String aUnitStr = ' ';
|
||||
aUnitStr += String( SvtResId( STR_SVT_BYTES ) );
|
||||
double fSize = nSize;
|
||||
int nDec = 0;
|
||||
ULONG nMega = 1024 * 1024;
|
||||
ULONG nGiga = nMega * 1024;
|
||||
|
||||
if ( nSize >= 10000 && nSize < nMega )
|
||||
{
|
||||
fSize /= 1024;
|
||||
aUnitStr = ' ';
|
||||
aUnitStr += String( SvtResId( STR_SVT_KB ) );
|
||||
nDec = 0;
|
||||
}
|
||||
else if ( nSize >= nMega && nSize < nGiga )
|
||||
{
|
||||
fSize /= nMega;
|
||||
aUnitStr = ' ';
|
||||
aUnitStr += String( SvtResId( STR_SVT_MB ) );
|
||||
nDec = 2;
|
||||
}
|
||||
else if ( nSize >= nGiga )
|
||||
{
|
||||
fSize /= nGiga;
|
||||
aUnitStr = ' ';
|
||||
aUnitStr += String( SvtResId( STR_SVT_GB ) );
|
||||
nDec = 3;
|
||||
}
|
||||
String aSizeStr;
|
||||
LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
|
||||
SolarMath::DoubleToString( aSizeStr, fSize, 'F', nDec, aLocaleWrapper.getNumDecimalSep().GetChar(0) );
|
||||
aSizeStr += aUnitStr;
|
||||
return aSizeStr;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
Sequence < OUString > GetFolderContentProperties_Impl( const String& rFolder, const ::com::sun::star::lang::Locale& rLocale, sal_Bool bFolder )
|
||||
{
|
||||
StringList_Impl* pProperties = NULL;
|
||||
INetURLObject aFolderObj( rFolder );
|
||||
DBG_ASSERT( aFolderObj.GetProtocol() != INET_PROT_NOT_VALID, "Invalid URL!" );
|
||||
try
|
||||
{
|
||||
Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
|
||||
Reference< XInteractionHandler > xInteractionHandler = Reference< XInteractionHandler > (
|
||||
xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uui.InteractionHandler") ) ), UNO_QUERY );
|
||||
|
||||
Content aCnt( aFolderObj.GetMainURL(), new CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() ) );
|
||||
Reference< XResultSet > xResultSet;
|
||||
Sequence< OUString > aProps(6);
|
||||
OUString* pProps = aProps.getArray();
|
||||
pProps[0] = OUString::createFromAscii( "Title" );
|
||||
pProps[1] = OUString::createFromAscii( "ContentType" );
|
||||
pProps[2] = OUString::createFromAscii( "Size" );
|
||||
pProps[3] = OUString::createFromAscii( "DateModified" );
|
||||
pProps[4] = OUString::createFromAscii( "IsFolder" );
|
||||
pProps[5] = OUString::createFromAscii( "TargetURL" );
|
||||
|
||||
try
|
||||
{
|
||||
Reference< com::sun::star::ucb::XDynamicResultSet > xDynResultSet;
|
||||
ResultSetInclude eInclude = bFolder ? INCLUDE_FOLDERS_AND_DOCUMENTS : INCLUDE_DOCUMENTS_ONLY;
|
||||
xDynResultSet = aCnt.createDynamicCursor( aProps, eInclude );
|
||||
|
||||
Reference < com::sun::star::ucb::XAnyCompareFactory > xFactory;
|
||||
Reference < XMultiServiceFactory > xMgr = getProcessServiceFactory();
|
||||
Reference < com::sun::star::ucb::XSortedDynamicResultSetFactory > xSRSFac(
|
||||
xMgr->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.ucb.SortedDynamicResultSetFactory") ), UNO_QUERY );
|
||||
|
||||
Sequence< com::sun::star::ucb::NumberedSortingInfo > aSortInfo( 2 );
|
||||
com::sun::star::ucb::NumberedSortingInfo* pInfo = aSortInfo.getArray();
|
||||
pInfo[ 0 ].ColumnIndex = 5;
|
||||
pInfo[ 0 ].Ascending = sal_False;
|
||||
pInfo[ 1 ].ColumnIndex = 1;
|
||||
pInfo[ 1 ].Ascending = sal_True;
|
||||
|
||||
Reference< com::sun::star::ucb::XDynamicResultSet > xDynamicResultSet;
|
||||
xDynamicResultSet =
|
||||
xSRSFac->createSortedDynamicResultSet( xDynResultSet, aSortInfo, xFactory );
|
||||
if ( xDynamicResultSet.is() )
|
||||
{
|
||||
sal_Int16 nCaps = xDynamicResultSet->getCapabilities();
|
||||
xResultSet = xDynamicResultSet->getStaticResultSet();
|
||||
}
|
||||
|
||||
// if ( xDynResultSet.is() )
|
||||
// xResultSet = xDynResultSet->getStaticResultSet();
|
||||
}
|
||||
catch( ::com::sun::star::ucb::CommandAbortedException& )
|
||||
{
|
||||
DBG_ERRORFILE( "createCursor: CommandAbortedException" );
|
||||
}
|
||||
catch( ::com::sun::star::uno::Exception& )
|
||||
{
|
||||
DBG_ERRORFILE( "createCursor: Any other exception" );
|
||||
}
|
||||
|
||||
if ( xResultSet.is() )
|
||||
{
|
||||
pProperties = new StringList_Impl;
|
||||
Reference< com::sun::star::sdbc::XRow > xRow( xResultSet, UNO_QUERY );
|
||||
Reference< com::sun::star::ucb::XContentAccess > xContentAccess( xResultSet, UNO_QUERY );
|
||||
ULONG nFolderPos = LIST_APPEND;
|
||||
|
||||
try
|
||||
{
|
||||
while ( xResultSet->next() )
|
||||
{
|
||||
String aTitle( xRow->getString(1) );
|
||||
String aType( xRow->getString(2) );
|
||||
sal_Int64 nSize = xRow->getLong(3);
|
||||
::com::sun::star::util::DateTime aDT = xRow->getTimestamp(4);
|
||||
sal_Bool bFolder = xRow->getBoolean(5);
|
||||
String aTargetURL( xRow->getString(6) );
|
||||
sal_Bool bTarget = aTargetURL.Len() > 0;
|
||||
String aContentURL( xContentAccess->queryContentIdentifierString() );
|
||||
|
||||
if ( bTarget &&
|
||||
INetURLObject( aContentURL ).GetProtocol() == INET_PROT_VND_SUN_STAR_HIER )
|
||||
{
|
||||
Content aCnt( aTargetURL, Reference< ::com::sun::star::ucb::XCommandEnvironment > () );
|
||||
aCnt.getPropertyValue( OUString::createFromAscii( "Size" ) ) >>= nSize;
|
||||
aCnt.getPropertyValue( OUString::createFromAscii( "DateModified" ) ) >>= aDT;
|
||||
}
|
||||
String aRow = aTitle;
|
||||
aRow += '\t';
|
||||
//! aRow += aType;
|
||||
//! aRow += '\t';
|
||||
aRow += String::CreateFromInt64( nSize );
|
||||
aRow += '\t';
|
||||
AppendDateTime_Impl( aDT, rLocale, aRow );
|
||||
aRow += '\t';
|
||||
if ( aTargetURL.Len() > 0 )
|
||||
aRow += aTargetURL;
|
||||
else
|
||||
aRow += aContentURL;
|
||||
aRow += '\t';
|
||||
aRow += bFolder ? '1' : '0';
|
||||
OUString* pRow = new OUString( aRow );
|
||||
ULONG nPos = LIST_APPEND;
|
||||
if ( bFolder )
|
||||
{
|
||||
if ( LIST_APPEND == nFolderPos )
|
||||
nFolderPos = 0;
|
||||
else
|
||||
nFolderPos++;
|
||||
nPos = nFolderPos;
|
||||
}
|
||||
pProperties->Insert( pRow, nPos );
|
||||
}
|
||||
}
|
||||
catch( ::com::sun::star::ucb::CommandAbortedException& )
|
||||
{
|
||||
DBG_ERRORFILE( "XContentAccess::next(): CommandAbortedException" );
|
||||
}
|
||||
catch( ::com::sun::star::uno::Exception& )
|
||||
{
|
||||
DBG_ERRORFILE( "XContentAccess::next(): Any other exception" );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( ::com::sun::star::uno::Exception& )
|
||||
{
|
||||
DBG_ERRORFILE( "GetFolderContents: Any other exception" );
|
||||
}
|
||||
|
||||
if ( pProperties )
|
||||
{
|
||||
ULONG nCount = pProperties->Count();
|
||||
Sequence < OUString > aRet( nCount );
|
||||
OUString* pRet = aRet.getArray();
|
||||
for ( ULONG i = 0; i < nCount; ++i )
|
||||
{
|
||||
OUString* pProperty = pProperties->GetObject(i);
|
||||
pRet[i] = *( pProperty );
|
||||
delete pProperty;
|
||||
}
|
||||
delete pProperties;
|
||||
return aRet;
|
||||
}
|
||||
else
|
||||
return Sequence < OUString > ();
|
||||
}
|
||||
|
||||
// class ViewTabListBox_Impl ---------------------------------------------
|
||||
|
||||
class ViewTabListBox_Impl : public SvHeaderTabListBox
|
||||
{
|
||||
private:
|
||||
HeaderBar* mpHeaderBar;
|
||||
sal_Bool mbResizeDisabled;
|
||||
sal_Bool mbAutoResize;
|
||||
|
||||
DECL_LINK( HeaderSelect_Impl, HeaderBar * );
|
||||
DECL_LINK( HeaderEndDrag_Impl, HeaderBar * );
|
||||
|
||||
public:
|
||||
ViewTabListBox_Impl( Window* pParent );
|
||||
~ViewTabListBox_Impl();
|
||||
|
||||
virtual void Resize();
|
||||
|
||||
void ClearAll();
|
||||
void EnableAutoResize() { mbAutoResize = sal_True; }
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
ViewTabListBox_Impl::ViewTabListBox_Impl( Window* pParent ) :
|
||||
|
||||
SvHeaderTabListBox( pParent, 0 ),
|
||||
|
||||
mpHeaderBar ( NULL ),
|
||||
mbResizeDisabled( sal_False ),
|
||||
mbAutoResize ( sal_False )
|
||||
|
||||
{
|
||||
Size aBoxSize = pParent->GetSizePixel();
|
||||
mpHeaderBar = new HeaderBar( pParent, WB_BUTTONSTYLE | WB_BOTTOMBORDER );
|
||||
mpHeaderBar->SetPosSizePixel( Point( 0, 0 ), Size( aBoxSize.Width(), 16 ) );
|
||||
|
||||
HeaderBarItemBits nBits = ( HIB_LEFT | HIB_VCENTER );
|
||||
mpHeaderBar->InsertItem( 1, String( SvtResId( STR_SVT_FILEVIEW_COLUMN_TITLE ) ), 220, nBits );
|
||||
mpHeaderBar->InsertItem( 2, String( SvtResId( STR_SVT_FILEVIEW_COLUMN_SIZE ) ), 80, nBits );
|
||||
mpHeaderBar->InsertItem( 3, String( SvtResId( STR_SVT_FILEVIEW_COLUMN_DATE ) ), 500, nBits );
|
||||
|
||||
mpHeaderBar->SetSelectHdl( LINK( this, ViewTabListBox_Impl, HeaderSelect_Impl ) );
|
||||
mpHeaderBar->SetEndDragHdl( LINK( this, ViewTabListBox_Impl, HeaderEndDrag_Impl ) );
|
||||
|
||||
Size aHeadSize = mpHeaderBar->GetSizePixel();
|
||||
SetPosSizePixel( Point( 0, aHeadSize.Height() ),
|
||||
Size( aBoxSize.Width(), aBoxSize.Height() - aHeadSize.Height() ) );
|
||||
InitHeaderBar( mpHeaderBar );
|
||||
SetHighlightRange();
|
||||
SetEntryHeight( ROW_HEIGHT );
|
||||
|
||||
Show();
|
||||
mpHeaderBar->Show();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
ViewTabListBox_Impl::~ViewTabListBox_Impl()
|
||||
{
|
||||
delete mpHeaderBar;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
IMPL_LINK( ViewTabListBox_Impl, HeaderSelect_Impl, HeaderBar*, pBar )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
IMPL_LINK( ViewTabListBox_Impl, HeaderEndDrag_Impl, HeaderBar*, pBar )
|
||||
{
|
||||
if ( pBar && !pBar->GetCurItemId() )
|
||||
return 0;
|
||||
|
||||
if ( !mpHeaderBar->IsItemMode() )
|
||||
{
|
||||
Size aSize;
|
||||
USHORT nTabs = mpHeaderBar->GetItemCount();
|
||||
long nTmpSize = 0;
|
||||
|
||||
for ( USHORT i = 1; i <= nTabs; ++i )
|
||||
{
|
||||
long nWidth = mpHeaderBar->GetItemSize(i);
|
||||
aSize.Width() = nWidth + nTmpSize;
|
||||
nTmpSize += nWidth;
|
||||
SetTab( i, aSize.Width(), MAP_PIXEL );
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
void ViewTabListBox_Impl::Resize()
|
||||
{
|
||||
SvTabListBox::Resize();
|
||||
Size aBoxSize = Control::GetParent()->GetOutputSizePixel();
|
||||
|
||||
if ( mbResizeDisabled || !aBoxSize.Width() )
|
||||
return;
|
||||
|
||||
Size aBarSize = mpHeaderBar->GetSizePixel();
|
||||
aBarSize.Width() = mbAutoResize ? aBoxSize.Width() : GetSizePixel().Width();
|
||||
mpHeaderBar->SetSizePixel( aBarSize );
|
||||
|
||||
if ( mbAutoResize )
|
||||
{
|
||||
mbResizeDisabled = sal_True;
|
||||
Point aPos = GetPosPixel();
|
||||
SetPosSizePixel( Point( 0, aBarSize.Height() ),
|
||||
Size( aBoxSize.Width(), aBoxSize.Height() - aBarSize.Height() ) );
|
||||
mbResizeDisabled = sal_False;
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
void ViewTabListBox_Impl::ClearAll()
|
||||
{
|
||||
for ( USHORT i = 0; i < GetEntryCount(); ++i )
|
||||
delete (SvtContentEntry*)GetEntry(i)->GetUserData();
|
||||
Clear();
|
||||
}
|
||||
|
||||
// class SvtFileView -----------------------------------------------------
|
||||
|
||||
void SvtFileView::OpenFolder()
|
||||
{
|
||||
mpView->ClearAll();
|
||||
Sequence< ::rtl::OUString > aFileProperties =
|
||||
GetFolderContentProperties_Impl( maViewURL, Application::GetSettings().GetLocale(), sal_True );
|
||||
const ::rtl::OUString* pFileProperties = aFileProperties.getConstArray();
|
||||
UINT32 i, nCount = aFileProperties.getLength();
|
||||
sal_Bool bExecFilter = ( maCurrentFilter.Len() > 0 ) && ( maCurrentFilter != maAllFilter );
|
||||
for ( i = 0; i < nCount; ++i )
|
||||
{
|
||||
String aRow( pFileProperties[i] );
|
||||
// extract columns
|
||||
String aTitle, aSize, aDate, aURL;
|
||||
xub_StrLen nIdx = 0;
|
||||
aTitle = aRow.GetToken( 0, '\t', nIdx );
|
||||
aSize = aRow.GetToken( 0, '\t', nIdx );
|
||||
aDate = aRow.GetToken( 0, '\t', nIdx );
|
||||
aURL = aRow.GetToken( 0, '\t', nIdx );
|
||||
sal_Unicode cFolder = aRow.GetToken( 0, '\t', nIdx ).GetChar(0);
|
||||
sal_Bool bIsFolder = ( '1' == cFolder );
|
||||
|
||||
if ( mbOnlyFolder && !bIsFolder )
|
||||
continue;
|
||||
|
||||
// build new row
|
||||
String aNewRow = aTitle;
|
||||
aNewRow += '\t';
|
||||
if ( !bIsFolder )
|
||||
{
|
||||
// folder haven't a size
|
||||
BigInt nSize( aSize );
|
||||
aNewRow += CreateExactSizeText_Impl( nSize );
|
||||
}
|
||||
aNewRow += '\t';
|
||||
aNewRow += aDate;
|
||||
// detect image
|
||||
sal_Bool bDoInsert = sal_True;
|
||||
Image aImage;
|
||||
if ( bIsFolder )
|
||||
aImage = maFolderImage;
|
||||
else
|
||||
{
|
||||
INetURLObject aObj( aURL );
|
||||
aImage = SvImageManager::GetImage( aObj, FALSE );
|
||||
|
||||
if ( bExecFilter )
|
||||
{
|
||||
bDoInsert = sal_False;
|
||||
String aExtension = aObj.getExtension();
|
||||
aExtension.ToLowerAscii();
|
||||
USHORT nCount = maCurrentFilter.GetTokenCount();
|
||||
|
||||
for ( USHORT i = 0; i < nCount; ++i )
|
||||
{
|
||||
String aFilter = maCurrentFilter.GetToken(i).Copy(2);
|
||||
if ( aFilter == aExtension )
|
||||
{
|
||||
bDoInsert = sal_True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( bDoInsert )
|
||||
{
|
||||
// insert entry and set user data
|
||||
SvLBoxEntry* pEntry = mpView->InsertEntry( aNewRow, aImage, aImage );
|
||||
SvtContentEntry* pUserData = new SvtContentEntry( aURL, bIsFolder );
|
||||
pEntry->SetUserData( pUserData );
|
||||
}
|
||||
}
|
||||
|
||||
mpView->SelectAll( FALSE );
|
||||
SvLBoxEntry* pFirst = mpView->First();
|
||||
if ( pFirst )
|
||||
mpView->SetCursor( pFirst, TRUE );
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
SvtFileView::SvtFileView( Window* pParent, const ResId& rResId,
|
||||
sal_Bool bOnlyFolder, sal_Bool bMultiSelection ) :
|
||||
|
||||
Control( pParent, rResId ),
|
||||
|
||||
mbOnlyFolder ( bOnlyFolder ),
|
||||
mbAutoResize ( sal_False ),
|
||||
maFolderImage ( SvtResId( IMG_SVT_FOLDER ) )
|
||||
|
||||
{
|
||||
mpView = new ViewTabListBox_Impl( this );
|
||||
long pTabs[] = { 4, 20, 220, 300, 600 };
|
||||
mpView->SetTabs( &pTabs[0], MAP_PIXEL );
|
||||
mpView->SetTabJustify( 1, AdjustRight ); // column "Size"
|
||||
maAllFilter = String::CreateFromAscii( "*.*" );
|
||||
if ( bMultiSelection )
|
||||
mpView->SetSelectionMode( MULTIPLE_SELECTION );
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
SvtFileView::~SvtFileView()
|
||||
{
|
||||
delete mpView;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
String SvtFileView::GetURL( SvLBoxEntry* pEntry ) const
|
||||
{
|
||||
String aURL;
|
||||
if ( pEntry && pEntry->GetUserData() )
|
||||
aURL = ( (SvtContentEntry*)pEntry->GetUserData() )->maURL;
|
||||
return aURL;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
String SvtFileView::GetCurrentURL() const
|
||||
{
|
||||
String aURL;
|
||||
SvLBoxEntry* pEntry = mpView->FirstSelected();
|
||||
if ( pEntry && pEntry->GetUserData() )
|
||||
aURL = ( (SvtContentEntry*)pEntry->GetUserData() )->maURL;
|
||||
return aURL;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
void SvtFileView::CreateNewFolder( const String& rNewFolder )
|
||||
{
|
||||
INetURLObject aObj( maViewURL );
|
||||
aObj.insertName( rNewFolder );
|
||||
String aURL = aObj.GetMainURL();
|
||||
if ( ::utl::UCBContentHelper::MakeFolder( aURL ) )
|
||||
{
|
||||
String aEntry = aObj.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET );
|
||||
SvLBoxEntry* pEntry = mpView->InsertEntry( aEntry, maFolderImage, maFolderImage );
|
||||
SvtContentEntry* pUserData = new SvtContentEntry( aURL, TRUE );
|
||||
pEntry->SetUserData( pUserData );
|
||||
mpView->MakeVisible( pEntry );
|
||||
}
|
||||
else
|
||||
{
|
||||
String aPath;
|
||||
if ( !::utl::LocalFileHelper::ConvertURLToSystemPath( aURL, aPath ) )
|
||||
aPath = aURL;
|
||||
String aErrorText( SvtResId( STR_SVT_FILEVIEW_ERR_MAKEFOLDER ) );
|
||||
String aVar( RTL_CONSTASCII_USTRINGPARAM("%1") );
|
||||
aErrorText.SearchAndReplace( aVar, aPath );
|
||||
ErrorBox aBox( this, WB_OK, aErrorText );
|
||||
aBox.Execute();
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
sal_Bool SvtFileView::HasPreviousLevel( String& rParentURL ) const
|
||||
{
|
||||
sal_Bool bRet = sal_False;
|
||||
Content aCnt( maViewURL, Reference< ::com::sun::star::ucb::XCommandEnvironment > () );
|
||||
Reference< XContent > xContent( aCnt.get() );
|
||||
Reference< com::sun::star::container::XChild > xChild( xContent, UNO_QUERY );
|
||||
if ( xChild.is() )
|
||||
{
|
||||
Reference< XContent > xParent( xChild->getParent(), UNO_QUERY );
|
||||
if ( xParent.is() )
|
||||
{
|
||||
rParentURL = String( xParent->getIdentifier()->getContentIdentifier() );
|
||||
bRet = ( rParentURL.Len() > 0 && rParentURL != maViewURL );
|
||||
}
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
sal_Bool SvtFileView::PreviousLevel( String& rNewURL )
|
||||
{
|
||||
sal_Bool bRet = sal_False;
|
||||
if ( HasPreviousLevel( rNewURL ) )
|
||||
{
|
||||
Initialize( rNewURL, maCurrentFilter );
|
||||
bRet = sal_True;
|
||||
}
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
void SvtFileView::SetHelpId( sal_uInt32 nHelpId )
|
||||
{
|
||||
mpView->SetHelpId( nHelpId );
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
void SvtFileView::SetSizePixel( const Size& rNewSize )
|
||||
{
|
||||
Control::SetSizePixel( rNewSize );
|
||||
mpView->SetSizePixel( rNewSize );
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
void SvtFileView::SetPosSizePixel( const Point& rNewPos, const Size& rNewSize )
|
||||
{
|
||||
SetPosPixel( rNewPos );
|
||||
SetSizePixel( rNewSize );
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
void SvtFileView::Initialize( const String& rURL, const String& rFilter )
|
||||
{
|
||||
maViewURL = rURL;
|
||||
maCurrentFilter = rFilter;
|
||||
maCurrentFilter.ToLowerAscii();
|
||||
OpenFolder();
|
||||
maOpenDoneLink.Call( this );
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
void SvtFileView::ExecuteFilter( const String& rFilter )
|
||||
{
|
||||
maCurrentFilter = rFilter;
|
||||
maCurrentFilter.ToLowerAscii();
|
||||
OpenFolder();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
void SvtFileView::SetNoSelection()
|
||||
{
|
||||
mpView->SelectAll( FALSE );
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
void SvtFileView::SetFocusInView()
|
||||
{
|
||||
mpView->GrabFocus();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
void SvtFileView::ResetCursor()
|
||||
{
|
||||
// deselect
|
||||
SvLBoxEntry* pEntry = mpView->FirstSelected();
|
||||
if ( pEntry )
|
||||
mpView->Select( pEntry, FALSE );
|
||||
// set cursor to the first entry
|
||||
mpView->SetCursor( mpView->First(), TRUE );
|
||||
mpView->Update();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
void SvtFileView::SetSelectHdl( const Link& rHdl )
|
||||
{
|
||||
mpView->SetSelectHdl( rHdl );
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
void SvtFileView::SetDoubleClickHdl( const Link& rHdl )
|
||||
{
|
||||
mpView->SetDoubleClickHdl( rHdl );
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
ULONG SvtFileView::GetSelectionCount() const
|
||||
{
|
||||
return mpView->GetSelectionCount();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
SvLBoxEntry* SvtFileView::FirstSelected() const
|
||||
{
|
||||
return mpView->FirstSelected();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
SvLBoxEntry* SvtFileView::NextSelected( SvLBoxEntry* pEntry ) const
|
||||
{
|
||||
return mpView->NextSelected( pEntry );
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
void SvtFileView::EnableAutoResize()
|
||||
{
|
||||
mpView->EnableAutoResize();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,252 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: fileview.src,v $
|
||||
*
|
||||
* $Revision: 1.1 $
|
||||
*
|
||||
* last change: $Author: pb $ $Date: 2001-05-07 10:33:55 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1
|
||||
* - Sun Industry Standards Source License Version 1.1
|
||||
*
|
||||
* Sun Microsystems Inc., October, 2000
|
||||
*
|
||||
* GNU Lesser General Public License Version 2.1
|
||||
* =============================================
|
||||
* Copyright 2000 by Sun Microsystems, Inc.
|
||||
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library 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 for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Sun Industry Standards Source License Version 1.1
|
||||
* =================================================
|
||||
* The contents of this file are subject to the Sun Industry Standards
|
||||
* Source License Version 1.1 (the "License"); You may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of the
|
||||
* License at http://www.openoffice.org/license.html.
|
||||
*
|
||||
* Software provided under this License is provided on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||
* See the License for the specific provisions governing your rights and
|
||||
* obligations concerning the Software.
|
||||
*
|
||||
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||
*
|
||||
* Copyright: 2000 by Sun Microsystems, Inc.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): _______________________________________
|
||||
*
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
// includes ------------------------------------------------------------------
|
||||
|
||||
#include "svtools.hrc"
|
||||
|
||||
// strings --------------------------------------------------------------------
|
||||
|
||||
String STR_SVT_FILEVIEW_COLUMN_TITLE
|
||||
{
|
||||
Text = "Titel";
|
||||
Text[English] = "Title";
|
||||
Text[ english_us ] = "Title";
|
||||
Text[ portuguese ] = "Título";
|
||||
Text[ russian ] = "Çàãîëîâîê";
|
||||
Text[ greek ] = "Ôßôëïò";
|
||||
Text[ dutch ] = "Titel";
|
||||
Text[ french ] = "Titre";
|
||||
Text[ spanish ] = "Título";
|
||||
Text[ italian ] = "Titolo";
|
||||
Text[ danish ] = "Titel";
|
||||
Text[ swedish ] = "Titel";
|
||||
Text[ polish ] = "Tytu³";
|
||||
Text[ portuguese_brazilian ] = "Title";
|
||||
Text[ japanese ] = "À²ÄÙ";
|
||||
Text[ korean ] = "Á¦¸ñ";
|
||||
Text[ chinese_simplified ] = "±êÌâ";
|
||||
Text[ chinese_traditional ] = "¼ÐÃD";
|
||||
Text[ turkish ] = "Title";
|
||||
Text[ arabic ] = "ÇáÚäæÇä";
|
||||
};
|
||||
|
||||
String STR_SVT_FILEVIEW_COLUMN_SIZE
|
||||
{
|
||||
Text = "Größe";
|
||||
Text[English] = "Size";
|
||||
Text[ english_us ] = "Size";
|
||||
Text[ portuguese ] = "Tamanho";
|
||||
Text[ russian ] = "Ðàçìåð";
|
||||
Text[ greek ] = "ÌÝãåèïò";
|
||||
Text[ dutch ] = "Grootte";
|
||||
Text[ french ] = "Taille";
|
||||
Text[ spanish ] = "Tamaño";
|
||||
Text[ italian ] = "Dimensioni";
|
||||
Text[ danish ] = "Størrelse";
|
||||
Text[ swedish ] = "Storlek";
|
||||
Text[ polish ] = "Rozmiar";
|
||||
Text[ portuguese_brazilian ] = "Size";
|
||||
Text[ japanese ] = "»²½Þ";
|
||||
Text[ korean ] = "Å©±â";
|
||||
Text[ chinese_simplified ] = "´óС";
|
||||
Text[ chinese_traditional ] = "¤j¤p";
|
||||
Text[ turkish ] = "Size";
|
||||
Text[ arabic ] = "ÇáÍÌã";
|
||||
};
|
||||
|
||||
String STR_SVT_FILEVIEW_COLUMN_DATE
|
||||
{
|
||||
Text = "Änderungsdatum";
|
||||
Text[English] = "Modified Date";
|
||||
Text[ english_us ] = "Modified Date";
|
||||
Text[ portuguese ] = "Modificado em";
|
||||
Text[ russian ] = "Äàòà èçìåíåíèÿ";
|
||||
Text[ greek ] = "Çìåñïìçíßá ôñïðïðïßçóçò";
|
||||
Text[ dutch ] = "Gewijzigd op";
|
||||
Text[ french ] = "Date de modification";
|
||||
Text[ spanish ] = "Fecha de modificación";
|
||||
Text[ italian ] = "Data di modifica";
|
||||
Text[ danish ] = "Ændringsdato";
|
||||
Text[ swedish ] = "Ändringsdatum";
|
||||
Text[ polish ] = "Data modyfikacji";
|
||||
Text[ portuguese_brazilian ] = "Modified Date";
|
||||
Text[ japanese ] = "•Ï�X“ú";
|
||||
Text[ korean ] = "º¯°æÀÏÀÚ";
|
||||
Text[ chinese_simplified ] = "¸ü¸ÄµÄÈÕÆÚ";
|
||||
Text[ chinese_traditional ] = "Åܧ󪺤é´Á";
|
||||
Text[ turkish ] = "Modified Date";
|
||||
Text[ arabic ] = "ÊÇÑíÎ ÇáÊÚÏíá";
|
||||
};
|
||||
|
||||
String STR_SVT_FILEVIEW_ERR_MAKEFOLDER
|
||||
{
|
||||
Text = "Der Ordner %1 konnte nicht angelegt werden.";
|
||||
Text[ english_us ] = "Could not create the folder %1.";
|
||||
};
|
||||
|
||||
String STR_SVT_BYTES
|
||||
{
|
||||
Text = "Bytes" ;
|
||||
Text [ ENGLISH ] = "Bytes" ;
|
||||
Text [ english_us ] = "Bytes" ;
|
||||
Text [ portuguese_brazilian ] = "Bytes" ;
|
||||
Text [ swedish ] = "Byte" ;
|
||||
Text [ danish ] = "Bytes" ;
|
||||
Text [ italian ] = "Byte" ;
|
||||
Text [ spanish ] = "Bytes" ;
|
||||
Text [ french ] = "Octet(s)" ;
|
||||
Text [ dutch ] = "Bytes" ;
|
||||
Text [ portuguese ] = "Bytes" ;
|
||||
Text[ chinese_simplified ] = "×Ö½Ú";
|
||||
Text[ russian ] = "áàéò";
|
||||
Text[ polish ] = "Bajty";
|
||||
Text[ japanese ] = "ÊÞ²Ä";
|
||||
Text[ chinese_traditional ] = "Bytes";
|
||||
Text[ arabic ] = "ÈÇíÊ";
|
||||
Text[ greek ] = "Bytes";
|
||||
Text[ korean ] = "¹ÙÀÌÆ®";
|
||||
Text[ turkish ] = "Byte";
|
||||
};
|
||||
|
||||
String STR_SVT_KB
|
||||
{
|
||||
Text = "KB" ;
|
||||
Text [ ENGLISH ] = "KB" ;
|
||||
Text [ portuguese ] = "KB" ;
|
||||
Text [ english_us ] = "KB" ;
|
||||
Text [ portuguese_brazilian ] = "KB" ;
|
||||
Text [ swedish ] = "kB" ;
|
||||
Text [ danish ] = "kB" ;
|
||||
Text [ italian ] = "KB" ;
|
||||
Text [ spanish ] = "KB" ;
|
||||
Text [ french ] = "Ko" ;
|
||||
Text [ dutch ] = "KB" ;
|
||||
Text[ chinese_simplified ] = "ǧ×Ö½Ú";
|
||||
Text[ russian ] = "ÊÁ";
|
||||
Text[ polish ] = "KB";
|
||||
Text[ japanese ] = "·ÛÊÞ²Ä";
|
||||
Text[ chinese_traditional ] = "KB";
|
||||
Text[ arabic ] = "ßíáæÈÇíÊ";
|
||||
Text[ greek ] = "KB";
|
||||
Text[ korean ] = "KB";
|
||||
Text[ turkish ] = "KB";
|
||||
};
|
||||
|
||||
String STR_SVT_MB
|
||||
{
|
||||
Text = "MB" ;
|
||||
Text [ ENGLISH ] = "MB" ;
|
||||
Text [ portuguese ] = "MB" ;
|
||||
Text [ english_us ] = "MB" ;
|
||||
Text [ portuguese_brazilian ] = "MB" ;
|
||||
Text [ swedish ] = "MB" ;
|
||||
Text [ danish ] = "MB" ;
|
||||
Text [ italian ] = "MB" ;
|
||||
Text [ spanish ] = "MB" ;
|
||||
Text [ french ] = "Mo" ;
|
||||
Text [ dutch ] = "MB" ;
|
||||
Text[ chinese_simplified ] = "Õ××Ö½Ú";
|
||||
Text[ russian ] = "ÌÁ";
|
||||
Text[ polish ] = "MB";
|
||||
Text[ japanese ] = "MB";
|
||||
Text[ chinese_traditional ] = "MB";
|
||||
Text[ arabic ] = "ãíÛÇÈÇíÊ";
|
||||
Text[ greek ] = "MB";
|
||||
Text[ korean ] = "MB";
|
||||
Text[ turkish ] = "MB";
|
||||
};
|
||||
|
||||
|
||||
String STR_SVT_GB
|
||||
{
|
||||
Text = "GB" ;
|
||||
Text [ ENGLISH ] = "GB" ;
|
||||
Text [ portuguese ] = "GB" ;
|
||||
Text [ english_us ] = "GB" ;
|
||||
Text [ portuguese_brazilian ] = "GB" ;
|
||||
Text [ swedish ] = "GB" ;
|
||||
Text [ danish ] = "GB" ;
|
||||
Text [ italian ] = "GB" ;
|
||||
Text [ spanish ] = "GB" ;
|
||||
Text [ french ] = "Go" ;
|
||||
Text [ dutch ] = "GB" ;
|
||||
Text[ chinese_simplified ] = "ǧÕ×";
|
||||
Text[ russian ] = "ÃÁ";
|
||||
Text[ polish ] = "GB";
|
||||
Text[ japanese ] = "GB";
|
||||
Text[ chinese_traditional ] = "GB";
|
||||
Text[ arabic ] = "ÌíÌÇÈÇíÊ";
|
||||
Text[ greek ] = "GB";
|
||||
Text[ korean ] = "GB";
|
||||
Text[ turkish ] = "GB";
|
||||
};
|
||||
|
||||
// Images ---------------------------------------------------------------------
|
||||
|
||||
Image IMG_SVT_FOLDER
|
||||
{
|
||||
ImageBitmap = Bitmap { File = "folder.bmp" ; };
|
||||
MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
|
||||
};
|
||||
|
||||
// eof ------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,676 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: imivctl.hxx,v $
|
||||
*
|
||||
* $Revision: 1.1 $
|
||||
*
|
||||
* last change: $Author: pb $ $Date: 2001-05-07 10:33:55 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1
|
||||
* - Sun Industry Standards Source License Version 1.1
|
||||
*
|
||||
* Sun Microsystems Inc., October, 2000
|
||||
*
|
||||
* GNU Lesser General Public License Version 2.1
|
||||
* =============================================
|
||||
* Copyright 2000 by Sun Microsystems, Inc.
|
||||
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library 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 for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Sun Industry Standards Source License Version 1.1
|
||||
* =================================================
|
||||
* The contents of this file are subject to the Sun Industry Standards
|
||||
* Source License Version 1.1 (the "License"); You may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of the
|
||||
* License at http://www.openoffice.org/license.html.
|
||||
*
|
||||
* Software provided under this License is provided on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||
* See the License for the specific provisions governing your rights and
|
||||
* obligations concerning the Software.
|
||||
*
|
||||
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||
*
|
||||
* Copyright: 2000 by Sun Microsystems, Inc.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): _______________________________________
|
||||
*
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#ifndef _IMPICNVW_HXX
|
||||
#define _IMPICNVW_HXX
|
||||
|
||||
#ifndef _VIRDEV_HXX
|
||||
#include <vcl/virdev.hxx>
|
||||
#endif
|
||||
#ifndef _SCRBAR_HXX
|
||||
#include <vcl/scrbar.hxx>
|
||||
#endif
|
||||
#ifndef _SVARRAY_HXX
|
||||
#include <svtools/svarray.hxx>
|
||||
#endif
|
||||
#ifndef _SV_TIMER_HXX
|
||||
#include <vcl/timer.hxx>
|
||||
#endif
|
||||
#ifndef _SV_SELENG_HXX
|
||||
#include <vcl/seleng.hxx>
|
||||
#endif
|
||||
#ifndef _TOOLS_DEBUG_HXX
|
||||
#include <tools/debug.hxx>
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#include "ivctrl.hxx"
|
||||
|
||||
class IcnCursor_Impl;
|
||||
class SvtIconChoiceCtrl;
|
||||
class SvxIconChoiceCtrlEntry;
|
||||
class IcnViewEdit_Impl;
|
||||
class IcnGridMap_Impl;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// some defines
|
||||
//
|
||||
#define PAINTFLAG_HOR_CENTERED 0x0001
|
||||
#define PAINTFLAG_VER_CENTERED 0x0002
|
||||
|
||||
#define F_VER_SBARSIZE_WITH_HBAR 0x0001
|
||||
#define F_HOR_SBARSIZE_WITH_VBAR 0x0002
|
||||
#define F_PAINTED 0x0004 // TRUE nach erstem Paint
|
||||
#define F_ADD_MODE 0x0008
|
||||
#define F_SELECTING_RECT 0x0020
|
||||
#define F_DOWN_CTRL 0x0080
|
||||
#define F_DOWN_DESELECT 0x0100
|
||||
#define F_START_EDITTIMER_IN_MOUSEUP 0x0400
|
||||
#define F_MOVED_ENTRIES 0x0800
|
||||
#define F_ENTRYLISTPOS_VALID 0x1000
|
||||
#define F_CLEARING_SELECTION 0x2000
|
||||
#define F_ARRANGING 0x4000
|
||||
|
||||
// alle Angaben in Pixel
|
||||
// Abstaende von Fensterraendern
|
||||
#define LROFFS_WINBORDER 4
|
||||
#define TBOFFS_WINBORDER 4
|
||||
// fuer das Bounding-Rectangle
|
||||
#define LROFFS_BOUND 2
|
||||
#define TBOFFS_BOUND 2
|
||||
// Abstand Fokusrechteck - Icon
|
||||
#define LROFFS_ICON 2
|
||||
#define TBOFFS_ICON 2
|
||||
// Abstaende Icon - Text
|
||||
#define HOR_DIST_BMP_STRING 3
|
||||
#define VER_DIST_BMP_STRING 3
|
||||
// Breitenoffset Highlight-Rect bei Text
|
||||
#define LROFFS_TEXT 2
|
||||
|
||||
#define DEFAULT_MAX_VIRT_WIDTH 200
|
||||
#define DEFAULT_MAX_VIRT_HEIGHT 200
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
//
|
||||
enum IcnViewFieldType
|
||||
{
|
||||
IcnViewFieldTypeDontknow = 0,
|
||||
IcnViewFieldTypeImage = 1,
|
||||
IcnViewFieldTypeText = 2
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Data about the focus of entries
|
||||
//
|
||||
struct LocalFocus
|
||||
{
|
||||
BOOL bOn;
|
||||
Rectangle aRect;
|
||||
Color aPenColor;
|
||||
|
||||
LocalFocus() { bOn = FALSE; }
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Entry-List
|
||||
//
|
||||
class EntryList_Impl : public List
|
||||
{
|
||||
private:
|
||||
|
||||
// Der Solaris-Compiler kann das noch nicht.
|
||||
#ifdef WNT
|
||||
List::Replace;
|
||||
List::Clear;
|
||||
#endif
|
||||
SvxIconChoiceCtrl_Impl* _pOwner;
|
||||
|
||||
void Removed_Impl( SvxIconChoiceCtrlEntry* pEntry );
|
||||
|
||||
public:
|
||||
EntryList_Impl(
|
||||
SvxIconChoiceCtrl_Impl*,
|
||||
USHORT _nInitSize = 1024,
|
||||
USHORT _nReSize = 1024 );
|
||||
EntryList_Impl(
|
||||
SvxIconChoiceCtrl_Impl*,
|
||||
USHORT _nBlockSize,
|
||||
USHORT _nInitSize,
|
||||
USHORT _nReSize );
|
||||
~EntryList_Impl();
|
||||
|
||||
void Clear();
|
||||
void Insert( SvxIconChoiceCtrlEntry* pEntry, ULONG nPos );
|
||||
SvxIconChoiceCtrlEntry* Remove( ULONG nPos );
|
||||
void Remove( SvxIconChoiceCtrlEntry* pEntry );
|
||||
};
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Implementation-class of IconChoiceCtrl
|
||||
//
|
||||
class SvxIconChoiceCtrl_Impl
|
||||
{
|
||||
friend class IcnCursor_Impl;
|
||||
friend class EntryList_Impl;
|
||||
friend class IcnGridMap_Impl;
|
||||
|
||||
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
|
||||
USHORT nFlags;
|
||||
USHORT nCurTextDrawFlags;
|
||||
ULONG nUserEventAdjustScrBars;
|
||||
ULONG nUserEventShowCursor;
|
||||
SvxIconChoiceCtrlEntry* pCurHighlightFrame;
|
||||
BOOL bHighlightFramePressed;
|
||||
SvxIconChoiceCtrlEntry* pHead; // Eintrag oben links
|
||||
SvxIconChoiceCtrlEntry* pCursor;
|
||||
SvxIconChoiceCtrlEntry* pPrevDropTarget;
|
||||
SvxIconChoiceCtrlEntry* pHdlEntry;
|
||||
SvxIconChoiceCtrlEntry* pDDRefEntry;
|
||||
VirtualDevice* pDDDev;
|
||||
VirtualDevice* pDDBufDev;
|
||||
VirtualDevice* pDDTempDev;
|
||||
VirtualDevice* pEntryPaintDev;
|
||||
SvxIconChoiceCtrlEntry* pAnchor; // fuer Selektion
|
||||
LocalFocus aFocus; // Data for focusrect
|
||||
|
||||
List* pDraggedSelection;
|
||||
SvxIconChoiceCtrlEntry* pCurEditedEntry;
|
||||
SvxIconChoiceCtrlTextMode eTextMode;
|
||||
SelectionMode eSelectionMode;
|
||||
ULONG nSelectionCount;
|
||||
SvxIconChoiceCtrlPositionMode ePositionMode;
|
||||
BOOL bBoundRectsDirty;
|
||||
BOOL bUpdateMode;
|
||||
BOOL bEntryEditingEnabled;
|
||||
BOOL bInDragDrop;
|
||||
void ShowCursor( BOOL bShow );
|
||||
|
||||
void ImpArrange( BOOL bKeepPredecessors = 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( BOOL bVirtSizeGrowedOnly = FALSE);
|
||||
void PositionScrollBars( long nRealWidth, long nRealHeight );
|
||||
long GetScrollBarPageSize( long nVisibleRange ) const { return ((nVisibleRange*75)/100); }
|
||||
long GetScrollBarLineSize() const { return nMaxBoundHeight / 2; }
|
||||
BOOL HandleScrollCommand( const CommandEvent& rCmd );
|
||||
void ToDocPos( Point& rPosPixel ) { rPosPixel -= pView->GetMapMode().GetOrigin(); }
|
||||
void InitScrollBarBox();
|
||||
SvxIconChoiceCtrlEntry* FindNewCursor();
|
||||
void ToggleSelection( SvxIconChoiceCtrlEntry* );
|
||||
void DeselectAllBut( SvxIconChoiceCtrlEntry*, BOOL bPaintSync=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,
|
||||
BOOL bAdd = TRUE,
|
||||
SvPtrarr* pOtherRects = 0 );
|
||||
|
||||
void SelectRange(
|
||||
SvxIconChoiceCtrlEntry* pStart,
|
||||
SvxIconChoiceCtrlEntry* pEnd,
|
||||
BOOL bAdd = 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;
|
||||
ULONG GetPredecessorGrid( const Point& rDocPos) const;
|
||||
|
||||
void InitPredecessors();
|
||||
void ClearPredecessors();
|
||||
|
||||
BOOL CheckVerScrollBar();
|
||||
BOOL CheckHorScrollBar();
|
||||
void CancelUserEvents();
|
||||
void EntrySelected( SvxIconChoiceCtrlEntry* pEntry, BOOL bSelect,
|
||||
BOOL bSyncPaint );
|
||||
void SaveSelection( List** );
|
||||
void RepaintEntries( USHORT nEntryFlagsMask );
|
||||
void SetListPositions();
|
||||
void SetDefaultTextSize();
|
||||
BOOL IsAutoArrange() const {
|
||||
return (BOOL)(ePositionMode == IcnViewPositionModeAutoArrange); }
|
||||
BOOL IsAutoAdjust() const {
|
||||
return (BOOL)(ePositionMode == IcnViewPositionModeAutoAdjust); }
|
||||
void DocRectChanged() { aDocRectChangedTimer.Start(); }
|
||||
void VisRectChanged() { aVisRectChangedTimer.Start(); }
|
||||
void SetOrigin( const Point&, BOOL bDoNotUpdateWallpaper = FALSE );
|
||||
|
||||
DECL_LINK( TextEditEndedHdl, IcnViewEdit_Impl* );
|
||||
|
||||
void ShowFocus ( Rectangle& rRect );
|
||||
void HideFocus ();
|
||||
void DrawFocusRect ( OutputDevice* pOut );
|
||||
|
||||
public:
|
||||
|
||||
long nGridDX,
|
||||
nGridDY;
|
||||
long nHorSBarHeight,
|
||||
nVerSBarWidth;
|
||||
|
||||
SvxIconChoiceCtrl_Impl( SvtIconChoiceCtrl* pView, WinBits nWinStyle );
|
||||
~SvxIconChoiceCtrl_Impl();
|
||||
|
||||
BOOL SetChoiceWithCursor ( BOOL bDo = TRUE ) { BOOL bOld=bChooseWithCursor; bChooseWithCursor = bDo; return bOld; }
|
||||
void Clear( BOOL bInCtor = FALSE );
|
||||
void SetStyle( WinBits nWinStyle );
|
||||
WinBits GetStyle() const { return nWinBits; }
|
||||
void InsertEntry( SvxIconChoiceCtrlEntry*, ULONG nPos, const Point* pPos=0 );
|
||||
void RemoveEntry( SvxIconChoiceCtrlEntry* pEntry );
|
||||
void FontModified();
|
||||
void SelectAll( BOOL bSelect = TRUE, BOOL bPaint = TRUE );
|
||||
void SelectEntry(
|
||||
SvxIconChoiceCtrlEntry*,
|
||||
BOOL bSelect,
|
||||
BOOL bCallHdl = TRUE,
|
||||
BOOL bAddToSelection = FALSE,
|
||||
BOOL bSyncPaint = FALSE );
|
||||
void Paint( const Rectangle& rRect );
|
||||
BOOL MouseButtonDown( const MouseEvent& );
|
||||
BOOL MouseButtonUp( const MouseEvent& );
|
||||
BOOL MouseMove( const MouseEvent&);
|
||||
BOOL RequestHelp( const HelpEvent& rHEvt );
|
||||
void SetCursor_Impl(
|
||||
SvxIconChoiceCtrlEntry* pOldCursor,
|
||||
SvxIconChoiceCtrlEntry* pNewCursor,
|
||||
BOOL bMod1,
|
||||
BOOL bShift,
|
||||
BOOL bPaintSync = FALSE);
|
||||
BOOL KeyInput( const KeyEvent& );
|
||||
void Resize();
|
||||
void GetFocus();
|
||||
void LoseFocus();
|
||||
void SetUpdateMode( BOOL bUpdate );
|
||||
BOOL GetUpdateMode() const { return bUpdateMode; }
|
||||
void PaintEntry( SvxIconChoiceCtrlEntry* pEntry, BOOL bIsBackgroundPainted=FALSE );
|
||||
void PaintEntry(
|
||||
SvxIconChoiceCtrlEntry*,
|
||||
const Point&,
|
||||
OutputDevice* pOut = 0,
|
||||
BOOL bIsBackgroundPainted = FALSE);
|
||||
void PaintEntryVirtOutDev( SvxIconChoiceCtrlEntry* );
|
||||
|
||||
void SetEntryPos(
|
||||
SvxIconChoiceCtrlEntry* pEntry,
|
||||
const Point& rPos,
|
||||
BOOL bAdjustRow = FALSE,
|
||||
BOOL bCheckScrollBars = FALSE,
|
||||
BOOL bKeepGridMap = FALSE );
|
||||
|
||||
void InvalidateEntry( SvxIconChoiceCtrlEntry* );
|
||||
IcnViewFieldType GetItem( SvxIconChoiceCtrlEntry*, const Point& rAbsPos );
|
||||
|
||||
void SetNoSelection();
|
||||
|
||||
SvxIconChoiceCtrlEntry* GetCurEntry() const { return pCursor; }
|
||||
void SetCursor(
|
||||
SvxIconChoiceCtrlEntry*,
|
||||
// TRUE == bei Single-Selection die Sel. mitfuehren
|
||||
BOOL bSyncSingleSelection = TRUE,
|
||||
BOOL bShowFocusAsync = FALSE );
|
||||
|
||||
SvxIconChoiceCtrlEntry* GetEntry( const Point& rDocPos, BOOL bHit = FALSE );
|
||||
SvxIconChoiceCtrlEntry* GetNextEntry( const Point& rDocPos, SvxIconChoiceCtrlEntry* pCurEntry );
|
||||
SvxIconChoiceCtrlEntry* GetPrevEntry( const Point& rDocPos, SvxIconChoiceCtrlEntry* pCurEntry );
|
||||
|
||||
Point GetEntryPos( SvxIconChoiceCtrlEntry* );
|
||||
void MakeEntryVisible( SvxIconChoiceCtrlEntry* pEntry, BOOL bBound = TRUE );
|
||||
|
||||
void Arrange(BOOL bKeepPredecessors = FALSE, long nSetMaxVirtWidth =0, long nSetMaxVirtHeight =0 );
|
||||
|
||||
Rectangle CalcFocusRect( SvxIconChoiceCtrlEntry* );
|
||||
Rectangle CalcBmpRect( SvxIconChoiceCtrlEntry*, const Point* pPos = 0 );
|
||||
Rectangle CalcTextRect(
|
||||
SvxIconChoiceCtrlEntry*,
|
||||
const Point* pPos = 0,
|
||||
BOOL bForInplaceEdit = 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();
|
||||
// berechnet alle ungueltigen BoundRects neu
|
||||
void RecalcAllBoundingRectsSmart();
|
||||
const Rectangle& GetEntryBoundRect( SvxIconChoiceCtrlEntry* );
|
||||
void InvalidateBoundingRect( SvxIconChoiceCtrlEntry* );
|
||||
void InvalidateBoundingRect( Rectangle& rRect ) { rRect.Right() = LONG_MAX; bBoundRectsDirty = TRUE; }
|
||||
BOOL IsBoundingRectValid( const Rectangle& rRect ) const { return (BOOL)( rRect.Right() != LONG_MAX ); }
|
||||
|
||||
void PaintEmphasis(
|
||||
const Rectangle& rRect1,
|
||||
const Rectangle& rRect2,
|
||||
BOOL bSelected,
|
||||
BOOL bDropTarget,
|
||||
BOOL bCursored,
|
||||
OutputDevice* pOut,
|
||||
BOOL bIsBackgroundPainted = FALSE);
|
||||
|
||||
void PaintItem(
|
||||
const Rectangle& rRect,
|
||||
IcnViewFieldType eItem,
|
||||
SvxIconChoiceCtrlEntry* pEntry,
|
||||
USHORT nPaintFlags,
|
||||
OutputDevice* pOut,
|
||||
const String* pStr = 0 );
|
||||
|
||||
// berechnet alle BoundingRects neu, wenn bMustRecalcBoundingRects == TRUE
|
||||
void CheckBoundingRects() { if (bBoundRectsDirty) RecalcAllBoundingRectsSmart(); }
|
||||
// berechnet alle invalidierten BoundingRects neu
|
||||
void UpdateBoundingRects();
|
||||
void ShowTargetEmphasis( SvxIconChoiceCtrlEntry* pEntry, BOOL bShow );
|
||||
void PrepareCommandEvent( const CommandEvent& );
|
||||
void Command( const CommandEvent& rCEvt );
|
||||
void ToTop( SvxIconChoiceCtrlEntry* );
|
||||
|
||||
ULONG GetSelectionCount() const;
|
||||
void SetGrid( const Size& );
|
||||
Size GetMinGrid() const;
|
||||
ULONG GetGridCount(
|
||||
const Size& rSize,
|
||||
BOOL bCheckScrBars,
|
||||
BOOL bSmartScrBar ) const;
|
||||
void Scroll( long nDeltaX, long nDeltaY, BOOL bScrollBar = FALSE );
|
||||
const Size& GetItemSize( SvxIconChoiceCtrlEntry*, IcnViewFieldType ) const;
|
||||
|
||||
void HideDDIcon();
|
||||
void ShowDDIcon( SvxIconChoiceCtrlEntry* pRefEntry, const Point& rPos );
|
||||
void HideShowDDIcon(
|
||||
SvxIconChoiceCtrlEntry* pRefEntry,
|
||||
const Point& rPos );
|
||||
|
||||
BOOL IsOver(
|
||||
SvPtrarr* pSelectedRectList,
|
||||
const Rectangle& rEntryBoundRect ) const;
|
||||
|
||||
void SelectRect(
|
||||
const Rectangle&,
|
||||
BOOL bAdd = TRUE,
|
||||
SvPtrarr* pOtherRects = 0 );
|
||||
|
||||
void CalcScrollOffsets(
|
||||
const Point& rRefPosPixel,
|
||||
long& rX,
|
||||
long& rY,
|
||||
BOOL bDragDrop = FALSE,
|
||||
USHORT nBorderWidth = 10 );
|
||||
|
||||
BOOL IsTextHit( SvxIconChoiceCtrlEntry* pEntry, const Point& rDocPos );
|
||||
void MakeVisible(
|
||||
const Rectangle& rDocPos,
|
||||
BOOL bInScrollBarEvent=FALSE,
|
||||
BOOL bCallRectChangedHdl = 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( BOOL bEnable ) { bEntryEditingEnabled = bEnable; }
|
||||
BOOL IsEntryEditingEnabled() const { return bEntryEditingEnabled; }
|
||||
BOOL IsEntryEditing() const { return (BOOL)(pCurEditedEntry!=0); }
|
||||
void EditEntry( SvxIconChoiceCtrlEntry* pEntry );
|
||||
void StopEntryEditing( BOOL bCancel );
|
||||
BOOL QueryDrop( DropEvent& rDEvt );
|
||||
void QueryDropImpl(
|
||||
const DropEvent& rDEvt,
|
||||
BOOL bAllow,
|
||||
SvxIconChoiceCtrlEntry* pTarget );
|
||||
BOOL Drop( const DropEvent& rDEvt );
|
||||
void DropStartImpl( const DropEvent& );
|
||||
void DropEndImpl();
|
||||
void InitStartDrag( const CommandEvent& rDEvt );
|
||||
void LockEntryPos( SvxIconChoiceCtrlEntry* pEntry, BOOL bLock );
|
||||
ULONG GetEntryCount() const { return aEntries.Count(); }
|
||||
SvxIconChoiceCtrlEntry* GetEntry( ULONG nPos ) { return (SvxIconChoiceCtrlEntry*)aEntries.GetObject(nPos); }
|
||||
SvxIconChoiceCtrlEntry* GetFirstSelectedEntry( ULONG& ) const;
|
||||
SvxIconChoiceCtrlEntry* GetNextSelectedEntry( ULONG& ) const;
|
||||
SvxIconChoiceCtrlEntry* GetHdlEntry() const { return pHdlEntry; }
|
||||
void SetHdlEntry( SvxIconChoiceCtrlEntry* pEntry ) { pHdlEntry = pEntry; }
|
||||
|
||||
SvxIconChoiceCtrlTextMode GetEntryTextModeSmart( const SvxIconChoiceCtrlEntry* pEntry ) const;
|
||||
void SetSelectionMode( SelectionMode eMode ) { eSelectionMode=eMode; }
|
||||
SelectionMode GetSelectionMode() const { return eSelectionMode; }
|
||||
void MoveDraggedEntries( const DropEvent& rDEvt );
|
||||
BOOL AreEntriesMoved() const { return (BOOL)((nFlags & F_MOVED_ENTRIES)!=0); }
|
||||
void SetEntriesMoved( BOOL bMoved )
|
||||
{
|
||||
if( bMoved ) nFlags |= F_MOVED_ENTRIES;
|
||||
else nFlags &= ~(F_MOVED_ENTRIES);
|
||||
}
|
||||
ULONG GetEntryListPos( SvxIconChoiceCtrlEntry* ) const;
|
||||
void SetEntryListPos( SvxIconChoiceCtrlEntry* pEntry, ULONG nNewPos );
|
||||
void SetEntryImageSize( const Size& rSize ) { aImageSize = rSize; }
|
||||
void SetEntryFlags( SvxIconChoiceCtrlEntry* pEntry, USHORT nFlags );
|
||||
SvxIconChoiceCtrlEntry* GoLeftRight( SvxIconChoiceCtrlEntry*, BOOL bRight );
|
||||
SvxIconChoiceCtrlEntry* GoUpDown( SvxIconChoiceCtrlEntry*, BOOL bDown );
|
||||
void InitSettings();
|
||||
Rectangle GetOutputRect() const;
|
||||
|
||||
BOOL ArePredecessorsSet() const { return (BOOL)(pHead != 0); }
|
||||
SvxIconChoiceCtrlEntry* GetPredecessorHead() const { return pHead; }
|
||||
void SetEntryPredecessor(SvxIconChoiceCtrlEntry* pEntry,SvxIconChoiceCtrlEntry* pPredecessor);
|
||||
BOOL GetEntryPredecessor(SvxIconChoiceCtrlEntry* pEntry,SvxIconChoiceCtrlEntry** ppPredecessor);
|
||||
// liefert gueltige Ergebnisse nur im AutoArrange-Modus!
|
||||
SvxIconChoiceCtrlEntry* FindEntryPredecessor( SvxIconChoiceCtrlEntry* pEntry, const Point& );
|
||||
|
||||
void SetPositionMode( SvxIconChoiceCtrlPositionMode );
|
||||
SvxIconChoiceCtrlPositionMode GetPositionMode() const { return ePositionMode;}
|
||||
|
||||
void Flush();
|
||||
void SetColumn( USHORT nIndex, const SvxIconChoiceCtrlColumnInfo& );
|
||||
const SvxIconChoiceCtrlColumnInfo* GetColumn( USHORT nIndex ) const;
|
||||
const SvxIconChoiceCtrlColumnInfo* GetItemColumn( USHORT nSubItem, long& rLeft ) const;
|
||||
|
||||
Rectangle GetDocumentRect() const { return Rectangle( Point(), aVirtOutputSize ); }
|
||||
Rectangle GetVisibleRect() const { return GetOutputRect(); }
|
||||
|
||||
void SetEntryHighlightFrame( SvxIconChoiceCtrlEntry* pEntry,BOOL bKeepHighlightFlags=FALSE );
|
||||
void HideEntryHighlightFrame();
|
||||
void DrawHighlightFrame( OutputDevice* pOut,
|
||||
const Rectangle& rBmpRect, BOOL bHide );
|
||||
void StopSelectTimer() { aCallSelectHdlTimer.Stop(); }
|
||||
void Tracking( const TrackingEvent& rTEvt );
|
||||
Point GetPopupMenuPosPixel() const;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
|
||||
class IcnCursor_Impl
|
||||
{
|
||||
SvxIconChoiceCtrl_Impl* pView;
|
||||
SvPtrarr* pColumns;
|
||||
SvPtrarr* pRows;
|
||||
long nCols;
|
||||
long nRows;
|
||||
short nDeltaWidth;
|
||||
short nDeltaHeight;
|
||||
SvxIconChoiceCtrlEntry* pCurEntry;
|
||||
void SetDeltas();
|
||||
void ImplCreate();
|
||||
void Create() { if( !pColumns ) ImplCreate(); }
|
||||
|
||||
USHORT GetSortListPos( SvPtrarr* pList, long nValue, int bVertical);
|
||||
SvxIconChoiceCtrlEntry* SearchCol(USHORT nCol,USHORT nTop,USHORT nBottom,USHORT nPref,
|
||||
BOOL bDown, BOOL bSimple );
|
||||
|
||||
SvxIconChoiceCtrlEntry* SearchRow(USHORT nRow,USHORT nRight,USHORT nLeft,USHORT nPref,
|
||||
BOOL bRight, BOOL bSimple );
|
||||
|
||||
public:
|
||||
IcnCursor_Impl( SvxIconChoiceCtrl_Impl* pOwner );
|
||||
~IcnCursor_Impl();
|
||||
void Clear();
|
||||
|
||||
// fuer Cursortravelling usw.
|
||||
SvxIconChoiceCtrlEntry* GoLeftRight( SvxIconChoiceCtrlEntry*, BOOL bRight );
|
||||
SvxIconChoiceCtrlEntry* GoUpDown( SvxIconChoiceCtrlEntry*, BOOL bDown );
|
||||
SvxIconChoiceCtrlEntry* GoPageUpDown( SvxIconChoiceCtrlEntry*, BOOL bDown );
|
||||
|
||||
// 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, SvxIconChoiceCtrlEntry* pRow=0);
|
||||
static void DestroyGridAdjustData( SvPtrarr& rLists );
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
|
||||
typedef ULONG GridId;
|
||||
|
||||
#define GRID_NOT_FOUND ((GridId)ULONG_MAX)
|
||||
|
||||
class IcnGridMap_Impl
|
||||
{
|
||||
Rectangle _aLastOccupiedGrid;
|
||||
SvxIconChoiceCtrl_Impl* _pView;
|
||||
BOOL* _pGridMap;
|
||||
USHORT _nGridCols, _nGridRows;
|
||||
|
||||
void Expand();
|
||||
void Create_Impl();
|
||||
void Create() { if(!_pGridMap) Create_Impl(); }
|
||||
|
||||
void GetMinMapSize( USHORT& rDX, USHORT& rDY ) const;
|
||||
|
||||
public:
|
||||
IcnGridMap_Impl(SvxIconChoiceCtrl_Impl* pView);
|
||||
~IcnGridMap_Impl();
|
||||
|
||||
void Clear();
|
||||
|
||||
GridId GetGrid( const Point& rDocPos, BOOL* pbClipped = 0 );
|
||||
GridId GetGrid( USHORT nGridX, USHORT nGridY );
|
||||
GridId GetUnoccupiedGrid( BOOL bOccupyFound=TRUE );
|
||||
|
||||
void OccupyGrids( const Rectangle&, BOOL bOccupy = TRUE );
|
||||
void OccupyGrids( const SvxIconChoiceCtrlEntry*, BOOL bOccupy = TRUE );
|
||||
void OccupyGrid( GridId nId, BOOL bOccupy = TRUE )
|
||||
{
|
||||
DBG_ASSERT(!_pGridMap || nId<(ULONG)(_nGridCols*_nGridRows),"OccupyGrid: Bad GridId");
|
||||
if(_pGridMap && nId < (ULONG)(_nGridCols *_nGridRows) )
|
||||
_pGridMap[ nId ] = bOccupy;
|
||||
}
|
||||
|
||||
Rectangle GetGridRect( GridId );
|
||||
void GetGridCoord( GridId, USHORT& rGridX, USHORT& rGridY );
|
||||
static ULONG GetGridCount( const Size& rSizePixel, USHORT nGridWidth, USHORT nGridHeight );
|
||||
|
||||
void OutputSizeChanged();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,881 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: imivctl2.cxx,v $
|
||||
*
|
||||
* $Revision: 1.1 $
|
||||
*
|
||||
* last change: $Author: pb $ $Date: 2001-05-07 10:33:55 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1
|
||||
* - Sun Industry Standards Source License Version 1.1
|
||||
*
|
||||
* Sun Microsystems Inc., October, 2000
|
||||
*
|
||||
* GNU Lesser General Public License Version 2.1
|
||||
* =============================================
|
||||
* Copyright 2000 by Sun Microsystems, Inc.
|
||||
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library 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 for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Sun Industry Standards Source License Version 1.1
|
||||
* =================================================
|
||||
* The contents of this file are subject to the Sun Industry Standards
|
||||
* Source License Version 1.1 (the "License"); You may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of the
|
||||
* License at http://www.openoffice.org/license.html.
|
||||
*
|
||||
* Software provided under this License is provided on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||
* See the License for the specific provisions governing your rights and
|
||||
* obligations concerning the Software.
|
||||
*
|
||||
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||
*
|
||||
* Copyright: 2000 by Sun Microsystems, Inc.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): _______________________________________
|
||||
*
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#ifndef _IMPICNVW_HXX
|
||||
#include "imivctl.hxx"
|
||||
#endif
|
||||
|
||||
IcnCursor_Impl::IcnCursor_Impl( SvxIconChoiceCtrl_Impl* pOwner )
|
||||
{
|
||||
pView = pOwner;
|
||||
pColumns = 0;
|
||||
pRows = 0;
|
||||
pCurEntry = 0;
|
||||
nDeltaWidth = 0;
|
||||
nDeltaHeight= 0;
|
||||
nCols = 0;
|
||||
nRows = 0;
|
||||
}
|
||||
|
||||
IcnCursor_Impl::~IcnCursor_Impl()
|
||||
{
|
||||
delete[] pColumns;
|
||||
delete[] pRows;
|
||||
}
|
||||
|
||||
USHORT IcnCursor_Impl::GetSortListPos( SvPtrarr* pList, long nValue,
|
||||
int bVertical )
|
||||
{
|
||||
USHORT nCount = (USHORT)pList->Count();
|
||||
if( !nCount )
|
||||
return 0;
|
||||
|
||||
USHORT nCurPos = 0;
|
||||
long nPrevValue = LONG_MIN;
|
||||
while( nCount )
|
||||
{
|
||||
const Rectangle& rRect=
|
||||
pView->GetEntryBoundRect((SvxIconChoiceCtrlEntry*)(pList->GetObject(nCurPos)));
|
||||
long nCurValue;
|
||||
if( bVertical )
|
||||
nCurValue = rRect.Top();
|
||||
else
|
||||
nCurValue = rRect.Left();
|
||||
if( nValue >= nPrevValue && nValue <= nCurValue )
|
||||
return (USHORT)nCurPos;
|
||||
nPrevValue = nCurValue;
|
||||
nCount--;
|
||||
nCurPos++;
|
||||
}
|
||||
return pList->Count();
|
||||
}
|
||||
|
||||
void IcnCursor_Impl::ImplCreate()
|
||||
{
|
||||
pView->CheckBoundingRects();
|
||||
DBG_ASSERT(pColumns==0&&pRows==0,"ImplCreate: Not cleared");
|
||||
|
||||
SetDeltas();
|
||||
|
||||
pColumns = new SvPtrarr[ nCols ];
|
||||
pRows = new SvPtrarr[ nRows ];
|
||||
|
||||
ULONG nCount = pView->aEntries.Count();
|
||||
for( ULONG nCur = 0; nCur < nCount; nCur++ )
|
||||
{
|
||||
SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( nCur );
|
||||
// const Rectangle& rRect = pView->GetEntryBoundRect( pEntry );
|
||||
Rectangle rRect( pView->CalcBmpRect( pEntry,0 ) );
|
||||
short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / nDeltaHeight );
|
||||
short nX = (short)( ((rRect.Left()+rRect.Right())/2) / nDeltaWidth );
|
||||
|
||||
// Rundungsfehler abfangen
|
||||
if( nY >= nRows )
|
||||
nY = nRows - 1;
|
||||
if( nX >= nCols )
|
||||
nX = nCols - 1;
|
||||
|
||||
USHORT nIns = GetSortListPos( &pColumns[nX], rRect.Top(), TRUE );
|
||||
pColumns[ nX ].Insert( pEntry, nIns );
|
||||
|
||||
nIns = GetSortListPos( &pRows[nY], rRect.Left(), FALSE );
|
||||
pRows[ nY ].Insert( pEntry, nIns );
|
||||
|
||||
pEntry->nX = nX;
|
||||
pEntry->nY = nY;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void IcnCursor_Impl::Clear()
|
||||
{
|
||||
if( pColumns )
|
||||
{
|
||||
delete[] pColumns;
|
||||
delete[] pRows;
|
||||
pColumns = 0;
|
||||
pRows = 0;
|
||||
pCurEntry = 0;
|
||||
nDeltaWidth = 0;
|
||||
nDeltaHeight = 0;
|
||||
}
|
||||
}
|
||||
|
||||
SvxIconChoiceCtrlEntry* IcnCursor_Impl::SearchCol(USHORT nCol,USHORT nTop,USHORT nBottom,
|
||||
USHORT nPref, BOOL bDown, BOOL bSimple )
|
||||
{
|
||||
DBG_ASSERT(pCurEntry,"SearchCol: No reference entry");
|
||||
SvPtrarr* pList = &(pColumns[ nCol ]);
|
||||
const USHORT nCount = pList->Count();
|
||||
if( !nCount )
|
||||
return 0;
|
||||
|
||||
const Rectangle& rRefRect = pView->GetEntryBoundRect(pCurEntry);
|
||||
|
||||
if( bSimple )
|
||||
{
|
||||
USHORT nListPos = pList->GetPos( pCurEntry );
|
||||
DBG_ASSERT(nListPos!=0xffff,"Entry not in Col-List");
|
||||
if( bDown )
|
||||
{
|
||||
while( nListPos < nCount-1 )
|
||||
{
|
||||
nListPos++;
|
||||
SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)pList->GetObject( nListPos );
|
||||
const Rectangle& rRect = pView->GetEntryBoundRect( pEntry );
|
||||
if( rRect.Top() > rRefRect.Top() )
|
||||
return pEntry;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
while( nListPos )
|
||||
{
|
||||
nListPos--;
|
||||
if( nListPos < nCount )
|
||||
{
|
||||
SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)pList->GetObject( nListPos );
|
||||
const Rectangle& rRect = pView->GetEntryBoundRect( pEntry );
|
||||
if( rRect.Top() < rRefRect.Top() )
|
||||
return pEntry;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if( nTop > nBottom )
|
||||
{
|
||||
USHORT nTemp = nTop;
|
||||
nTop = nBottom;
|
||||
nBottom = nTemp;
|
||||
}
|
||||
long nMinDistance = LONG_MAX;
|
||||
SvxIconChoiceCtrlEntry* pResult = 0;
|
||||
for( USHORT nCur = 0; nCur < nCount; nCur++ )
|
||||
{
|
||||
SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)(pList->GetObject( nCur ));
|
||||
if( pEntry != pCurEntry )
|
||||
{
|
||||
USHORT nY = pEntry->nY;
|
||||
if( nY >= nTop && nY <= nBottom )
|
||||
{
|
||||
const Rectangle& rRect = pView->GetEntryBoundRect( pEntry );
|
||||
long nDistance = rRect.Top() - rRefRect.Top();
|
||||
if( nDistance < 0 )
|
||||
nDistance *= -1;
|
||||
if( nDistance && nDistance < nMinDistance )
|
||||
{
|
||||
nMinDistance = nDistance;
|
||||
pResult = pEntry;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return pResult;
|
||||
}
|
||||
|
||||
SvxIconChoiceCtrlEntry* IcnCursor_Impl::SearchRow(USHORT nRow,USHORT nLeft,USHORT nRight,
|
||||
USHORT nPref, BOOL bRight, BOOL bSimple )
|
||||
{
|
||||
DBG_ASSERT(pCurEntry,"SearchRow: No reference entry");
|
||||
SvPtrarr* pList = &(pRows[ nRow ]);
|
||||
const USHORT nCount = pList->Count();
|
||||
if( !nCount )
|
||||
return 0;
|
||||
|
||||
const Rectangle& rRefRect = pView->GetEntryBoundRect(pCurEntry);
|
||||
|
||||
if( bSimple )
|
||||
{
|
||||
USHORT nListPos = pList->GetPos( pCurEntry );
|
||||
DBG_ASSERT(nListPos!=0xffff,"Entry not in Row-List");
|
||||
if( bRight )
|
||||
{
|
||||
while( nListPos < nCount-1 )
|
||||
{
|
||||
nListPos++;
|
||||
SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)pList->GetObject( nListPos );
|
||||
const Rectangle& rRect = pView->GetEntryBoundRect( pEntry );
|
||||
if( rRect.Left() > rRefRect.Left() )
|
||||
return pEntry;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
while( nListPos )
|
||||
{
|
||||
nListPos--;
|
||||
if( nListPos < nCount )
|
||||
{
|
||||
SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)pList->GetObject( nListPos );
|
||||
const Rectangle& rRect = pView->GetEntryBoundRect( pEntry );
|
||||
if( rRect.Left() < rRefRect.Left() )
|
||||
return pEntry;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
if( nRight < nLeft )
|
||||
{
|
||||
USHORT nTemp = nRight;
|
||||
nRight = nLeft;
|
||||
nLeft = nTemp;
|
||||
}
|
||||
long nMinDistance = LONG_MAX;
|
||||
SvxIconChoiceCtrlEntry* pResult = 0;
|
||||
for( USHORT nCur = 0; nCur < nCount; nCur++ )
|
||||
{
|
||||
SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)(pList->GetObject( nCur ));
|
||||
if( pEntry != pCurEntry )
|
||||
{
|
||||
USHORT nX = pEntry->nX;
|
||||
if( nX >= nLeft && nX <= nRight )
|
||||
{
|
||||
const Rectangle& rRect = pView->GetEntryBoundRect( 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 = 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
|
||||
*/
|
||||
|
||||
SvxIconChoiceCtrlEntry* IcnCursor_Impl::GoLeftRight( SvxIconChoiceCtrlEntry* pEntry, BOOL bRight )
|
||||
{
|
||||
SvxIconChoiceCtrlEntry* pResult;
|
||||
pCurEntry = pEntry;
|
||||
Create();
|
||||
USHORT nY = pEntry->nY;
|
||||
USHORT nX = pEntry->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 ,nCols-1, nX, TRUE, TRUE );
|
||||
else
|
||||
pResult = SearchRow( nY, nX ,0, nX, FALSE, TRUE );
|
||||
if( pResult )
|
||||
return pResult;
|
||||
|
||||
long nCurCol = nX;
|
||||
|
||||
long nColOffs, nLastCol;
|
||||
if( bRight )
|
||||
{
|
||||
nColOffs = 1;
|
||||
nLastCol = nCols;
|
||||
}
|
||||
else
|
||||
{
|
||||
nColOffs = -1;
|
||||
nLastCol = -1; // 0-1
|
||||
}
|
||||
|
||||
USHORT nRowMin = nY;
|
||||
USHORT nRowMax = nY;
|
||||
do
|
||||
{
|
||||
SvxIconChoiceCtrlEntry* pEntry = SearchCol((USHORT)nCurCol,nRowMin,nRowMax,nY,TRUE, FALSE);
|
||||
if( pEntry )
|
||||
return pEntry;
|
||||
if( nRowMin )
|
||||
nRowMin--;
|
||||
if( nRowMax < (nRows-1))
|
||||
nRowMax++;
|
||||
nCurCol += nColOffs;
|
||||
} while( nCurCol != nLastCol );
|
||||
return 0;
|
||||
}
|
||||
|
||||
SvxIconChoiceCtrlEntry* IcnCursor_Impl::GoPageUpDown( SvxIconChoiceCtrlEntry* pStart, BOOL bDown)
|
||||
{
|
||||
if( pView->IsAutoArrange() && !(pView->nWinBits & WB_ALIGN_TOP) )
|
||||
{
|
||||
const long nPos = (long)pView->GetEntryListPos( pStart );
|
||||
long nEntriesInView = (pView->aOutputSize.Height() / pView->nGridDY);
|
||||
nEntriesInView *=
|
||||
((pView->aOutputSize.Width()+(pView->nGridDX/2)) / pView->nGridDX );
|
||||
long nNewPos = nPos;
|
||||
if( bDown )
|
||||
{
|
||||
nNewPos += nEntriesInView;
|
||||
if( nNewPos >= (long)pView->aEntries.Count() )
|
||||
nNewPos = pView->aEntries.Count() - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
nNewPos -= nEntriesInView;
|
||||
if( nNewPos < 0 )
|
||||
nNewPos = 0;
|
||||
}
|
||||
if( nPos != nNewPos )
|
||||
return (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( (ULONG)nNewPos );
|
||||
return 0;
|
||||
}
|
||||
long nOpt = pView->GetEntryBoundRect( pStart ).Top();
|
||||
if( bDown )
|
||||
{
|
||||
nOpt += pView->aOutputSize.Height();
|
||||
nOpt -= pView->nGridDY;
|
||||
}
|
||||
else
|
||||
{
|
||||
nOpt -= pView->aOutputSize.Height();
|
||||
nOpt += pView->nGridDY;
|
||||
}
|
||||
if( nOpt < 0 )
|
||||
nOpt = 0;
|
||||
|
||||
long nPrevErr = LONG_MAX;
|
||||
|
||||
SvxIconChoiceCtrlEntry* pPrev = pStart;
|
||||
SvxIconChoiceCtrlEntry* pNext = GoUpDown( pStart, bDown );
|
||||
while( pNext )
|
||||
{
|
||||
long nCur = pView->GetEntryBoundRect( pNext ).Top();
|
||||
long nErr = nOpt - nCur;
|
||||
if( nErr < 0 )
|
||||
nErr *= -1;
|
||||
if( nErr > nPrevErr )
|
||||
return pPrev;
|
||||
nPrevErr = nErr;
|
||||
pPrev = pNext;
|
||||
pNext = GoUpDown( pNext, bDown );
|
||||
}
|
||||
if( pPrev != pStart )
|
||||
return pPrev;
|
||||
return 0;
|
||||
}
|
||||
|
||||
SvxIconChoiceCtrlEntry* IcnCursor_Impl::GoUpDown( SvxIconChoiceCtrlEntry* pEntry, BOOL bDown)
|
||||
{
|
||||
if( pView->IsAutoArrange() && !(pView->nWinBits & WB_ALIGN_TOP) )
|
||||
{
|
||||
ULONG nPos = pView->GetEntryListPos( pEntry );
|
||||
if( bDown && nPos < (pView->aEntries.Count() - 1) )
|
||||
return (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( nPos + 1 );
|
||||
else if( !bDown && nPos > 0 )
|
||||
return (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( nPos - 1 );
|
||||
return 0;
|
||||
}
|
||||
|
||||
SvxIconChoiceCtrlEntry* pResult;
|
||||
pCurEntry = pEntry;
|
||||
Create();
|
||||
USHORT nY = pEntry->nY;
|
||||
USHORT nX = pEntry->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 ,nRows-1, nY, TRUE, TRUE );
|
||||
else
|
||||
pResult = SearchCol( nX, nY ,0, nY, FALSE, TRUE );
|
||||
if( pResult )
|
||||
return pResult;
|
||||
|
||||
long nCurRow = nY;
|
||||
|
||||
long nRowOffs, nLastRow;
|
||||
if( bDown )
|
||||
{
|
||||
nRowOffs = 1;
|
||||
nLastRow = nRows;
|
||||
}
|
||||
else
|
||||
{
|
||||
nRowOffs = -1;
|
||||
nLastRow = -1; // 0-1
|
||||
}
|
||||
|
||||
USHORT nColMin = nX;
|
||||
USHORT nColMax = nX;
|
||||
do
|
||||
{
|
||||
SvxIconChoiceCtrlEntry* pEntry = SearchRow((USHORT)nCurRow,nColMin,nColMax,nX,TRUE, FALSE);
|
||||
if( pEntry )
|
||||
return pEntry;
|
||||
if( nColMin )
|
||||
nColMin--;
|
||||
if( nColMax < (nCols-1))
|
||||
nColMax++;
|
||||
nCurRow += nRowOffs;
|
||||
} while( nCurRow != nLastRow );
|
||||
return 0;
|
||||
}
|
||||
|
||||
void IcnCursor_Impl::SetDeltas()
|
||||
{
|
||||
const Size& rSize = pView->aVirtOutputSize;
|
||||
nCols = rSize.Width() / pView->nGridDX;
|
||||
if( !nCols )
|
||||
nCols = 1;
|
||||
nRows = rSize.Height() / pView->nGridDY;
|
||||
if( (nRows * pView->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");
|
||||
}
|
||||
}
|
||||
|
||||
void IcnCursor_Impl::CreateGridAjustData( SvPtrarr& rLists, SvxIconChoiceCtrlEntry* pRefEntry)
|
||||
{
|
||||
if( !pRefEntry )
|
||||
{
|
||||
USHORT nRows = (USHORT)(pView->aVirtOutputSize.Height() / pView->nGridDY);
|
||||
nRows++; // wg. Abrundung!
|
||||
|
||||
if( !nRows )
|
||||
return;
|
||||
for( USHORT nCurList = 0; nCurList < nRows; nCurList++ )
|
||||
{
|
||||
SvPtrarr* pRow = new SvPtrarr;
|
||||
rLists.Insert( (void*)pRow, nCurList );
|
||||
}
|
||||
const ULONG nCount = pView->aEntries.Count();
|
||||
for( ULONG nCur = 0; nCur < nCount; nCur++ )
|
||||
{
|
||||
SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( nCur );
|
||||
const Rectangle& rRect = pView->GetEntryBoundRect( pEntry );
|
||||
short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / pView->nGridDY );
|
||||
USHORT nIns = GetSortListPos((SvPtrarr*)rLists[nY],rRect.Left(),FALSE);
|
||||
((SvPtrarr*)rLists[ nY ])->Insert( pEntry, nIns );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Aufbau eines hor. "Schlauchs" auf der RefEntry-Zeile
|
||||
// UEBERLEGEN: BoundingRect nehmen wg. Ueberlappungen???
|
||||
Rectangle rRefRect( pView->CalcBmpRect( pRefEntry ) );
|
||||
//const Rectangle& rRefRect = pView->GetEntryBoundRect( pRefEntry );
|
||||
short nRefRow = (short)( ((rRefRect.Top()+rRefRect.Bottom())/2) / pView->nGridDY );
|
||||
SvPtrarr* pRow = new SvPtrarr;
|
||||
rLists.Insert( (void*)pRow, 0 );
|
||||
ULONG nCount = pView->aEntries.Count();
|
||||
for( ULONG nCur = 0; nCur < nCount; nCur++ )
|
||||
{
|
||||
SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( nCur );
|
||||
Rectangle rRect( pView->CalcBmpRect(pEntry) );
|
||||
//const Rectangle& rRect = pView->GetEntryBoundRect( pEntry );
|
||||
short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / pView->nGridDY );
|
||||
if( nY == nRefRow )
|
||||
{
|
||||
USHORT nIns = GetSortListPos( pRow, rRect.Left(), FALSE );
|
||||
pRow->Insert( pEntry, nIns );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//static
|
||||
void IcnCursor_Impl::DestroyGridAdjustData( SvPtrarr& rLists )
|
||||
{
|
||||
const USHORT nCount = rLists.Count();
|
||||
for( USHORT nCur = 0; nCur < nCount; nCur++ )
|
||||
{
|
||||
SvPtrarr* pArr = (SvPtrarr*)rLists[ nCur ];
|
||||
delete pArr;
|
||||
}
|
||||
rLists.Remove( 0, rLists.Count() );
|
||||
}
|
||||
|
||||
IcnGridMap_Impl::IcnGridMap_Impl(SvxIconChoiceCtrl_Impl* pView)
|
||||
{
|
||||
_pView = pView;
|
||||
_pGridMap = 0;
|
||||
_nGridCols = 0;
|
||||
_nGridRows = 0;
|
||||
}
|
||||
|
||||
IcnGridMap_Impl::~IcnGridMap_Impl()
|
||||
{
|
||||
DELETEZ(_pGridMap);
|
||||
}
|
||||
|
||||
void IcnGridMap_Impl::Expand()
|
||||
{
|
||||
if( !_pGridMap )
|
||||
Create_Impl();
|
||||
else
|
||||
{
|
||||
USHORT nNewGridRows = _nGridRows;
|
||||
USHORT nNewGridCols = _nGridCols;
|
||||
if( _pView->nWinBits & WB_ALIGN_TOP )
|
||||
nNewGridRows += 50;
|
||||
else
|
||||
nNewGridCols += 50;
|
||||
|
||||
BOOL* pNewGridMap = new BOOL[nNewGridRows*nNewGridCols];
|
||||
memset( pNewGridMap, 0, nNewGridRows * nNewGridCols * sizeof(BOOL) );
|
||||
memcpy( pNewGridMap, _pGridMap, _nGridRows * _nGridCols * sizeof(BOOL) );
|
||||
delete _pGridMap;
|
||||
_pGridMap = pNewGridMap;
|
||||
_nGridRows = nNewGridRows;
|
||||
_nGridCols = nNewGridCols;
|
||||
}
|
||||
}
|
||||
|
||||
void IcnGridMap_Impl::Create_Impl()
|
||||
{
|
||||
DBG_ASSERT(!_pGridMap,"Unnecessary call to IcnGridMap_Impl::Create_Impl()");
|
||||
if( _pGridMap )
|
||||
return;
|
||||
GetMinMapSize( _nGridCols, _nGridRows );
|
||||
if( _pView->nWinBits & WB_ALIGN_TOP )
|
||||
_nGridRows += 50; // avoid resize of gridmap too often
|
||||
else
|
||||
_nGridCols += 50;
|
||||
|
||||
_pGridMap = new BOOL[ _nGridRows * _nGridCols];
|
||||
memset( (void*)_pGridMap, 0, _nGridRows * _nGridCols );
|
||||
|
||||
const ULONG nCount = _pView->aEntries.Count();
|
||||
for( ULONG nCur=0; nCur < nCount; nCur++ )
|
||||
OccupyGrids( (SvxIconChoiceCtrlEntry*)_pView->aEntries.GetObject( nCur ));
|
||||
}
|
||||
|
||||
void IcnGridMap_Impl::GetMinMapSize( USHORT& rDX, USHORT& rDY ) const
|
||||
{
|
||||
long nX, nY;
|
||||
if( _pView->nWinBits & WB_ALIGN_TOP )
|
||||
{
|
||||
// The view grows in vertical direction. Its max. width is _pView->nMaxVirtWidth
|
||||
nX = _pView->nMaxVirtWidth;
|
||||
if( !nX )
|
||||
nX = _pView->pView->GetOutputSizePixel().Width();
|
||||
if( !(_pView->nFlags & F_ARRANGING) )
|
||||
nX -= _pView->nVerSBarWidth;
|
||||
|
||||
nY = _pView->aVirtOutputSize.Height();
|
||||
}
|
||||
else
|
||||
{
|
||||
// The view grows in horizontal direction. Its max. height is _pView->nMaxVirtHeight
|
||||
nY = _pView->nMaxVirtHeight;
|
||||
if( !nY )
|
||||
nY = _pView->pView->GetOutputSizePixel().Height();
|
||||
if( !(_pView->nFlags & F_ARRANGING) )
|
||||
nY -= _pView->nHorSBarHeight;
|
||||
nX = _pView->aVirtOutputSize.Width();
|
||||
}
|
||||
|
||||
if( !nX )
|
||||
nX = DEFAULT_MAX_VIRT_WIDTH;
|
||||
if( !nY )
|
||||
nY = DEFAULT_MAX_VIRT_HEIGHT;
|
||||
|
||||
long nDX = nX / _pView->nGridDX;
|
||||
long nDY = nY / _pView->nGridDY;
|
||||
|
||||
if( !nDX )
|
||||
nDX++;
|
||||
if( !nDY )
|
||||
nDY++;
|
||||
|
||||
rDX = (USHORT)nDX;
|
||||
rDY = (USHORT)nDY;
|
||||
}
|
||||
|
||||
GridId IcnGridMap_Impl::GetGrid( USHORT nGridX, USHORT nGridY )
|
||||
{
|
||||
Create();
|
||||
if( _pView->nWinBits & WB_ALIGN_TOP )
|
||||
return nGridX + ( nGridY * _nGridCols );
|
||||
else
|
||||
return nGridY + ( nGridX * _nGridRows );
|
||||
}
|
||||
|
||||
GridId IcnGridMap_Impl::GetGrid( const Point& rDocPos, BOOL* pbClipped )
|
||||
{
|
||||
Create();
|
||||
|
||||
long nX = rDocPos.X();
|
||||
long nY = rDocPos.Y();
|
||||
nX -= LROFFS_WINBORDER;
|
||||
nY -= TBOFFS_WINBORDER;
|
||||
nX /= _pView->nGridDX;
|
||||
nY /= _pView->nGridDY;
|
||||
BOOL bClipped = FALSE;
|
||||
if( nX >= _nGridCols )
|
||||
{
|
||||
nX = _nGridCols - 1;
|
||||
bClipped = TRUE;
|
||||
}
|
||||
if( nY >= _nGridRows )
|
||||
{
|
||||
nY = _nGridRows - 1;
|
||||
bClipped = TRUE;
|
||||
}
|
||||
GridId nId = GetGrid( (USHORT)nX, (USHORT)nY );
|
||||
if( pbClipped )
|
||||
*pbClipped = bClipped;
|
||||
DBG_ASSERT(nId <(ULONG)(_nGridCols*_nGridRows),"GetGrid failed");
|
||||
return nId;
|
||||
}
|
||||
|
||||
Rectangle IcnGridMap_Impl::GetGridRect( GridId nId )
|
||||
{
|
||||
Create();
|
||||
USHORT nGridX, nGridY;
|
||||
GetGridCoord( nId, nGridX, nGridY );
|
||||
const long nLeft = nGridX * _pView->nGridDX+ LROFFS_WINBORDER;
|
||||
const long nTop = nGridY * _pView->nGridDY + TBOFFS_WINBORDER;
|
||||
return Rectangle(
|
||||
nLeft, nTop,
|
||||
nLeft + _pView->nGridDX,
|
||||
nTop + _pView->nGridDY );
|
||||
}
|
||||
|
||||
GridId IcnGridMap_Impl::GetUnoccupiedGrid( BOOL bOccupyFound )
|
||||
{
|
||||
Create();
|
||||
ULONG nStart = 0;
|
||||
BOOL bExpanded = FALSE;
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
const ULONG nCount = (USHORT)(_nGridCols * _nGridRows);
|
||||
for( ULONG nCur = nStart; nCur < nCount; nCur++ )
|
||||
{
|
||||
if( !_pGridMap[ nCur ] )
|
||||
{
|
||||
if( bOccupyFound )
|
||||
_pGridMap[ nCur ] = TRUE;
|
||||
return (GridId)nCur;
|
||||
}
|
||||
}
|
||||
DBG_ASSERT(!bExpanded,"ExpandGrid failed");
|
||||
if( bExpanded )
|
||||
return 0; // prevent never ending loop
|
||||
bExpanded = TRUE;
|
||||
Expand();
|
||||
nStart = nCount;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 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, 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, BOOL bUsed )
|
||||
{
|
||||
if( !_pGridMap )
|
||||
return;
|
||||
|
||||
if( bUsed )
|
||||
{
|
||||
if( _aLastOccupiedGrid == rRect )
|
||||
return;
|
||||
_aLastOccupiedGrid = rRect;
|
||||
}
|
||||
else
|
||||
_aLastOccupiedGrid.SetEmpty();
|
||||
|
||||
BOOL bTopLeftClipped, bBottomRightClipped;
|
||||
GridId nIdTL = GetGrid( rRect.TopLeft(), &bTopLeftClipped );
|
||||
GridId nIdBR = GetGrid( rRect.BottomRight(), &bBottomRightClipped );
|
||||
|
||||
if( bTopLeftClipped && bBottomRightClipped )
|
||||
return;
|
||||
|
||||
USHORT nX1,nX2,nY1,nY2;
|
||||
GetGridCoord( nIdTL, nX1, nY1 );
|
||||
GetGridCoord( nIdBR, nX2, nY2 );
|
||||
USHORT 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()
|
||||
{
|
||||
if( _pGridMap )
|
||||
{
|
||||
DELETEZ(_pGridMap);
|
||||
_nGridRows = 0;
|
||||
_nGridCols = 0;
|
||||
_aLastOccupiedGrid.SetEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
ULONG IcnGridMap_Impl::GetGridCount( const Size& rSizePixel, USHORT nDX, USHORT nDY)
|
||||
{
|
||||
long ndx = (rSizePixel.Width() - LROFFS_WINBORDER) / nDX;
|
||||
if( ndx < 0 ) ndx *= -1;
|
||||
long ndy = (rSizePixel.Height() - TBOFFS_WINBORDER) / nDY;
|
||||
if( ndy < 0 ) ndy *= -1;
|
||||
return (ULONG)(ndx * ndy);
|
||||
}
|
||||
|
||||
void IcnGridMap_Impl::OutputSizeChanged()
|
||||
{
|
||||
if( _pGridMap )
|
||||
{
|
||||
USHORT nCols, nRows;
|
||||
GetMinMapSize( nCols, nRows );
|
||||
if( _pView->nWinBits & WB_ALIGN_TOP )
|
||||
{
|
||||
if( nCols != _nGridCols )
|
||||
Clear();
|
||||
else if( nRows >= _nGridRows )
|
||||
Expand();
|
||||
}
|
||||
else
|
||||
{
|
||||
if( nRows != _nGridRows )
|
||||
Clear();
|
||||
else if( nCols >= _nGridCols )
|
||||
Expand();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Independendly of the views alignment (TOP or LEFT) the gridmap
|
||||
// should contain the data in a continues region, to make it possible
|
||||
// to copy the whole block if the gridmap needs to be expanded.
|
||||
void IcnGridMap_Impl::GetGridCoord( GridId nId, USHORT& rGridX, USHORT& rGridY )
|
||||
{
|
||||
Create();
|
||||
if( _pView->nWinBits & WB_ALIGN_TOP )
|
||||
{
|
||||
rGridX = (USHORT)(nId % _nGridCols);
|
||||
rGridY = (USHORT)(nId / _nGridCols);
|
||||
}
|
||||
else
|
||||
{
|
||||
rGridX = (USHORT)(nId / _nGridRows);
|
||||
rGridY = (USHORT)(nId % _nGridRows);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,523 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: ivctrl.cxx,v $
|
||||
*
|
||||
* $Revision: 1.1 $
|
||||
*
|
||||
* last change: $Author: pb $ $Date: 2001-05-07 10:33:55 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1
|
||||
* - Sun Industry Standards Source License Version 1.1
|
||||
*
|
||||
* Sun Microsystems Inc., October, 2000
|
||||
*
|
||||
* GNU Lesser General Public License Version 2.1
|
||||
* =============================================
|
||||
* Copyright 2000 by Sun Microsystems, Inc.
|
||||
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library 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 for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Sun Industry Standards Source License Version 1.1
|
||||
* =================================================
|
||||
* The contents of this file are subject to the Sun Industry Standards
|
||||
* Source License Version 1.1 (the "License"); You may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of the
|
||||
* License at http://www.openoffice.org/license.html.
|
||||
*
|
||||
* Software provided under this License is provided on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||
* See the License for the specific provisions governing your rights and
|
||||
* obligations concerning the Software.
|
||||
*
|
||||
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||
*
|
||||
* Copyright: 2000 by Sun Microsystems, Inc.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): _______________________________________
|
||||
*
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#pragma hdrstop
|
||||
|
||||
#include "ivctrl.hxx"
|
||||
#include "imivctl.hxx"
|
||||
|
||||
#ifndef _SV_BITMAPEX_HXX
|
||||
#include <vcl/bitmapex.hxx>
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
|
|
||||
| class : SvxIconChoiceCtrlEntry
|
||||
|
|
||||
\*****************************************************************************/
|
||||
|
||||
SvxIconChoiceCtrlEntry::SvxIconChoiceCtrlEntry( const String& rText, const Image& rImage, USHORT _nFlags )
|
||||
{
|
||||
aText = rText;
|
||||
aImage = rImage;
|
||||
pUserData = NULL;
|
||||
|
||||
nFlags = _nFlags;
|
||||
eTextMode = IcnShowTextShort;
|
||||
pblink = 0;
|
||||
pflink = 0;
|
||||
}
|
||||
|
||||
SvxIconChoiceCtrlEntry::SvxIconChoiceCtrlEntry( USHORT _nFlags )
|
||||
{
|
||||
pUserData = NULL;
|
||||
|
||||
nFlags = _nFlags;
|
||||
eTextMode = IcnShowTextShort;
|
||||
pblink = 0;
|
||||
pflink = 0;
|
||||
}
|
||||
|
||||
void SvxIconChoiceCtrlEntry::SetMoved( BOOL bMoved )
|
||||
{
|
||||
if( bMoved )
|
||||
nFlags |= ICNVIEW_FLAG_POS_MOVED;
|
||||
else
|
||||
nFlags &= ~ICNVIEW_FLAG_POS_MOVED;
|
||||
}
|
||||
|
||||
void SvxIconChoiceCtrlEntry::LockPos( BOOL bLock )
|
||||
{
|
||||
if( bLock )
|
||||
nFlags |= ICNVIEW_FLAG_POS_LOCKED;
|
||||
else
|
||||
nFlags &= ~ICNVIEW_FLAG_POS_LOCKED;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
SvxIconChoiceCtrlColumnInfo::SvxIconChoiceCtrlColumnInfo( const SvxIconChoiceCtrlColumnInfo& rInfo )
|
||||
: aColText( rInfo.aColText ), aColImage( rInfo.aColImage )
|
||||
{
|
||||
nWidth = rInfo.nWidth;
|
||||
eAlignment = rInfo.eAlignment;
|
||||
nSubItem = rInfo.nSubItem;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
|
||||
| class : SvtIconChoiceCtrl
|
||||
|
|
||||
\*****************************************************************************/
|
||||
|
||||
SvtIconChoiceCtrl::SvtIconChoiceCtrl( Window* pParent, WinBits nWinStyle )
|
||||
: Control( pParent, nWinStyle | WB_CLIPCHILDREN ) // WB_CLIPCHILDREN an, da ScrollBars auf dem Fenster liegen!
|
||||
{
|
||||
bAutoFontColor=FALSE;
|
||||
_pImp = new SvxIconChoiceCtrl_Impl( this, nWinStyle );
|
||||
SetLineColor();
|
||||
_pImp->SetGrid( Size(100,70) );
|
||||
_pImp->InitSettings();
|
||||
|
||||
_pImp->SetPositionMode (IcnViewPositionModeAutoArrange);
|
||||
}
|
||||
|
||||
SvtIconChoiceCtrl::SvtIconChoiceCtrl( Window* pParent, const ResId& rResId ) :
|
||||
Control( pParent, rResId )
|
||||
{
|
||||
bAutoFontColor=FALSE;
|
||||
_pImp = new SvxIconChoiceCtrl_Impl( this, WB_BORDER );
|
||||
SetLineColor();
|
||||
_pImp->SetGrid( Size(100,70) );
|
||||
_pImp->InitSettings();
|
||||
|
||||
_pImp->SetPositionMode (IcnViewPositionModeAutoArrange);
|
||||
}
|
||||
|
||||
SvtIconChoiceCtrl::~SvtIconChoiceCtrl()
|
||||
{
|
||||
delete _pImp;
|
||||
}
|
||||
|
||||
SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::InsertEntry( ULONG nPos, const Point* pPos, USHORT nFlags )
|
||||
{
|
||||
SvxIconChoiceCtrlEntry* pEntry = new SvxIconChoiceCtrlEntry( nFlags );
|
||||
_pImp->InsertEntry( pEntry, nPos, pPos );
|
||||
return pEntry;
|
||||
}
|
||||
|
||||
SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::InsertEntry( const String& rText, const Image& rImage, ULONG nPos, const Point* pPos, USHORT nFlags )
|
||||
{
|
||||
SvxIconChoiceCtrlEntry* pEntry = new SvxIconChoiceCtrlEntry( rText, rImage, nFlags);
|
||||
|
||||
_pImp->InsertEntry( pEntry, nPos, pPos );
|
||||
|
||||
return pEntry;
|
||||
}
|
||||
|
||||
BOOL SvtIconChoiceCtrl::EditedEntry( SvxIconChoiceCtrlEntry*, const XubString& rNewText, BOOL bCancelled )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
BOOL SvtIconChoiceCtrl::EditingEntry( SvxIconChoiceCtrlEntry* pEntry )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
void SvtIconChoiceCtrl::DrawEntryImage( SvxIconChoiceCtrlEntry* pEntry, const Point& rPos, OutputDevice& rDev )
|
||||
{
|
||||
rDev.DrawImage ( rPos, pEntry->GetImage() );
|
||||
}
|
||||
String SvtIconChoiceCtrl::GetEntryText( SvxIconChoiceCtrlEntry* pEntry, BOOL bInplaceEdit )
|
||||
{
|
||||
return pEntry->GetText();
|
||||
}
|
||||
BOOL SvtIconChoiceCtrl::HasBackground() const
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
BOOL SvtIconChoiceCtrl::HasFont() const
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
BOOL SvtIconChoiceCtrl::HasFontTextColor() const
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
BOOL SvtIconChoiceCtrl::HasFontFillColor() const
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void SvtIconChoiceCtrl::Paint( const Rectangle& rRect )
|
||||
{
|
||||
_pImp->Paint( rRect );
|
||||
}
|
||||
|
||||
void SvtIconChoiceCtrl::MouseButtonDown( const MouseEvent& rMEvt )
|
||||
{
|
||||
if( !_pImp->MouseButtonDown( rMEvt ) )
|
||||
Control::MouseButtonDown( rMEvt );
|
||||
}
|
||||
|
||||
void SvtIconChoiceCtrl::MouseButtonUp( const MouseEvent& rMEvt )
|
||||
{
|
||||
if( !_pImp->MouseButtonUp( rMEvt ) )
|
||||
Control::MouseButtonUp( rMEvt );
|
||||
}
|
||||
|
||||
void SvtIconChoiceCtrl::MouseMove( const MouseEvent& rMEvt )
|
||||
{
|
||||
if( !_pImp->MouseMove( rMEvt ) )
|
||||
Control::MouseMove( rMEvt );
|
||||
}
|
||||
void SvtIconChoiceCtrl::ArrangeIcons()
|
||||
{
|
||||
if ( GetStyle() & WB_ALIGN_TOP )
|
||||
{
|
||||
Size aFullSize;
|
||||
Rectangle aEntryRect;
|
||||
|
||||
for ( ULONG i = 0; i < GetEntryCount(); i++ )
|
||||
{
|
||||
SvxIconChoiceCtrlEntry* pEntry = GetEntry ( i );
|
||||
aEntryRect = _pImp->GetEntryBoundRect ( pEntry );
|
||||
|
||||
aFullSize.setWidth ( aFullSize.getWidth()+aEntryRect.GetWidth() );
|
||||
}
|
||||
|
||||
_pImp->Arrange ( FALSE, aFullSize.getWidth() );
|
||||
}
|
||||
else if ( GetStyle() & WB_ALIGN_LEFT )
|
||||
{
|
||||
Size aFullSize;
|
||||
Rectangle aEntryRect;
|
||||
|
||||
for ( ULONG i = 0; i < GetEntryCount(); i++ )
|
||||
{
|
||||
SvxIconChoiceCtrlEntry* pEntry = GetEntry ( i );
|
||||
aEntryRect = _pImp->GetEntryBoundRect ( pEntry );
|
||||
|
||||
aFullSize.setHeight ( aFullSize.getHeight()+aEntryRect.GetHeight() );
|
||||
}
|
||||
|
||||
_pImp->Arrange ( FALSE, 0, aFullSize.getHeight() );
|
||||
}
|
||||
else
|
||||
{
|
||||
_pImp->Arrange();
|
||||
}
|
||||
_pImp->Arrange( FALSE, 0, 1000 );
|
||||
}
|
||||
void SvtIconChoiceCtrl::Resize()
|
||||
{
|
||||
_pImp->Resize();
|
||||
Control::Resize();
|
||||
}
|
||||
|
||||
Point SvtIconChoiceCtrl::GetLogicPos( const Point& rPosPixel ) const
|
||||
{
|
||||
Point aPos( rPosPixel );
|
||||
aPos -= GetMapMode().GetOrigin();
|
||||
return aPos;
|
||||
}
|
||||
|
||||
Point SvtIconChoiceCtrl::GetPixelPos( const Point& rPosLogic ) const
|
||||
{
|
||||
Point aPos( rPosLogic );
|
||||
aPos += GetMapMode().GetOrigin();
|
||||
return aPos;
|
||||
}
|
||||
|
||||
void SvtIconChoiceCtrl::DocumentRectChanged()
|
||||
{
|
||||
_aDocRectChangedHdl.Call( this );
|
||||
}
|
||||
|
||||
void SvtIconChoiceCtrl::VisibleRectChanged()
|
||||
{
|
||||
_aVisRectChangedHdl.Call( this );
|
||||
}
|
||||
|
||||
void SvtIconChoiceCtrl::GetFocus()
|
||||
{
|
||||
_pImp->GetFocus();
|
||||
Control::GetFocus();
|
||||
}
|
||||
|
||||
void SvtIconChoiceCtrl::LoseFocus()
|
||||
{
|
||||
_pImp->LoseFocus();
|
||||
Control::LoseFocus();
|
||||
}
|
||||
|
||||
void SvtIconChoiceCtrl::SetUpdateMode( BOOL bUpdate )
|
||||
{
|
||||
Control::SetUpdateMode( bUpdate );
|
||||
_pImp->SetUpdateMode( bUpdate );
|
||||
}
|
||||
void SvtIconChoiceCtrl::SetFont( const Font& rFont )
|
||||
{
|
||||
if( rFont != GetFont() )
|
||||
{
|
||||
Control::SetFont( rFont );
|
||||
_pImp->FontModified();
|
||||
}
|
||||
}
|
||||
|
||||
void SvtIconChoiceCtrl::SetPointFont( const Font& rFont )
|
||||
{
|
||||
if( rFont != GetPointFont() )
|
||||
{
|
||||
Control::SetPointFont( rFont );
|
||||
_pImp->FontModified();
|
||||
}
|
||||
}
|
||||
SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::GetEntry( const Point& rPixPos, BOOL bHit ) const
|
||||
{
|
||||
Point aPos( rPixPos );
|
||||
aPos -= GetMapMode().GetOrigin();
|
||||
return ((SvtIconChoiceCtrl*)this)->_pImp->GetEntry( aPos, bHit );
|
||||
}
|
||||
|
||||
void SvtIconChoiceCtrl::SetStyle( WinBits nWinStyle )
|
||||
{
|
||||
_pImp->SetStyle( nWinStyle );
|
||||
}
|
||||
|
||||
WinBits SvtIconChoiceCtrl::GetStyle() const
|
||||
{
|
||||
return _pImp->GetStyle();
|
||||
}
|
||||
void SvtIconChoiceCtrl::Command( const CommandEvent& rCEvt )
|
||||
{
|
||||
_pImp->Command( rCEvt );
|
||||
}
|
||||
|
||||
void SvtIconChoiceCtrl::SetEntryTextMode( SvxIconChoiceCtrlTextMode eMode, SvxIconChoiceCtrlEntry* pEntry )
|
||||
{
|
||||
_pImp->SetEntryTextMode( eMode, pEntry );
|
||||
}
|
||||
|
||||
SvxIconChoiceCtrlTextMode SvtIconChoiceCtrl::GetEntryTextMode( const SvxIconChoiceCtrlEntry* pEntry ) const
|
||||
{
|
||||
return _pImp->GetEntryTextModeSmart( pEntry );
|
||||
}
|
||||
|
||||
SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::GetNextEntry( const Point& rPixPos, SvxIconChoiceCtrlEntry* pCurEntry, BOOL ) const
|
||||
{
|
||||
Point aPos( rPixPos );
|
||||
aPos -= GetMapMode().GetOrigin();
|
||||
return ((SvtIconChoiceCtrl*)this)->_pImp->GetNextEntry( aPos, pCurEntry );
|
||||
}
|
||||
|
||||
SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::GetPrevEntry( const Point& rPixPos, SvxIconChoiceCtrlEntry* pCurEntry, BOOL ) const
|
||||
{
|
||||
Point aPos( rPixPos );
|
||||
aPos -= GetMapMode().GetOrigin();
|
||||
return ((SvtIconChoiceCtrl*)this)->_pImp->GetPrevEntry( aPos, pCurEntry );
|
||||
}
|
||||
ULONG SvtIconChoiceCtrl::GetEntryCount() const
|
||||
{
|
||||
return _pImp->GetEntryCount();
|
||||
}
|
||||
|
||||
SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::GetEntry( ULONG nPos ) const
|
||||
{
|
||||
return _pImp->GetEntry( nPos );
|
||||
}
|
||||
|
||||
void SvtIconChoiceCtrl::RemoveEntry( SvxIconChoiceCtrlEntry* pEntry )
|
||||
{
|
||||
_pImp->RemoveEntry( pEntry );
|
||||
}
|
||||
|
||||
|
||||
SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::GetSelectedEntry( ULONG& rPos ) const
|
||||
{
|
||||
return _pImp->GetFirstSelectedEntry( rPos );
|
||||
}
|
||||
void SvtIconChoiceCtrl::ClickIcon()
|
||||
{
|
||||
/*
|
||||
ULONG nPos;
|
||||
SvxIconChoiceCtrlEntry* pSelectedEntry = GetSelectedEntry ( nPos );
|
||||
*/
|
||||
_aClickIconHdl.Call( this );
|
||||
}
|
||||
BOOL SvtIconChoiceCtrl::IsEntryEditing() const
|
||||
{
|
||||
return _pImp->IsEntryEditing();
|
||||
}
|
||||
|
||||
BOOL SvtIconChoiceCtrl::SetChoiceWithCursor ( BOOL bDo )
|
||||
{
|
||||
return _pImp->SetChoiceWithCursor (bDo);
|
||||
}
|
||||
void SvtIconChoiceCtrl::KeyInput( const KeyEvent& rKEvt )
|
||||
{
|
||||
BOOL bKeyUsed = DoKeyInput( rKEvt );
|
||||
if ( !bKeyUsed )
|
||||
{
|
||||
_pCurKeyEvent = (KeyEvent*)&rKEvt;
|
||||
Control::KeyInput( rKEvt );
|
||||
_pCurKeyEvent = 0;
|
||||
}
|
||||
}
|
||||
BOOL SvtIconChoiceCtrl::DoKeyInput( const KeyEvent& rKEvt )
|
||||
{
|
||||
// unter OS/2 bekommen wir auch beim Editieren Key-Up/Down
|
||||
if( IsEntryEditing() )
|
||||
return TRUE;
|
||||
_pCurKeyEvent = (KeyEvent*)&rKEvt;
|
||||
BOOL bHandled = _pImp->KeyInput( rKEvt );
|
||||
_pCurKeyEvent = 0;
|
||||
return bHandled;
|
||||
}
|
||||
ULONG SvtIconChoiceCtrl::GetEntryListPos( SvxIconChoiceCtrlEntry* pEntry ) const
|
||||
{
|
||||
return _pImp->GetEntryListPos( pEntry );
|
||||
}
|
||||
void SvtIconChoiceCtrl::InvalidateEntry( SvxIconChoiceCtrlEntry* pEntry )
|
||||
{
|
||||
_pImp->InvalidateEntry( pEntry );
|
||||
}
|
||||
void SvtIconChoiceCtrl::Clear()
|
||||
{
|
||||
_pImp->Clear();
|
||||
}
|
||||
void SvtIconChoiceCtrl::StateChanged( StateChangedType nType )
|
||||
{
|
||||
Control::StateChanged( nType );
|
||||
}
|
||||
|
||||
|
||||
void SvtIconChoiceCtrl::DataChanged( const DataChangedEvent& rDCEvt )
|
||||
{
|
||||
if ( ((rDCEvt.GetType() == DATACHANGED_SETTINGS) ||
|
||||
(rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
|
||||
(rDCEvt.GetType() == DATACHANGED_FONTS) ) &&
|
||||
(rDCEvt.GetFlags() & SETTINGS_STYLE) )
|
||||
{
|
||||
_pImp->InitSettings();
|
||||
Invalidate(INVALIDATE_NOCHILDREN);
|
||||
}
|
||||
else
|
||||
Control::DataChanged( rDCEvt );
|
||||
}
|
||||
|
||||
void SvtIconChoiceCtrl::SetBackground( const Wallpaper& rPaper )
|
||||
{
|
||||
if( rPaper != GetBackground() )
|
||||
{
|
||||
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
|
||||
Wallpaper aEmpty;
|
||||
if( rPaper == aEmpty )
|
||||
Control::SetBackground( rStyleSettings.GetWindowColor() );
|
||||
else
|
||||
{
|
||||
Wallpaper aBackground( rPaper );
|
||||
// HACK, da Hintergrund sonst transparent sein koennte
|
||||
if( !aBackground.IsBitmap() )
|
||||
aBackground.SetStyle( WALLPAPER_TILE );
|
||||
|
||||
WallpaperStyle eStyle = aBackground.GetStyle();
|
||||
Color aBack( aBackground.GetColor());
|
||||
Color aTrans( COL_TRANSPARENT );
|
||||
if( aBack == aTrans && (
|
||||
(!aBackground.IsBitmap() ||
|
||||
aBackground.GetBitmap().IsTransparent() ||
|
||||
(eStyle != WALLPAPER_TILE && eStyle != WALLPAPER_SCALE))))
|
||||
{
|
||||
aBackground.SetColor( rStyleSettings.GetWindowColor() );
|
||||
}
|
||||
if( aBackground.IsScrollable() )
|
||||
{
|
||||
Rectangle aRect;
|
||||
aRect.SetSize( Size(32765, 32765) );
|
||||
aBackground.SetRect( aRect );
|
||||
}
|
||||
else
|
||||
{
|
||||
Rectangle aRect( _pImp->GetOutputRect() );
|
||||
aBackground.SetRect( aRect );
|
||||
}
|
||||
Control::SetBackground( aBackground );
|
||||
}
|
||||
|
||||
// bei hart attributierter Textfarbe keine 'Automatik', die eine
|
||||
// lesbare Textfarbe einstellt.
|
||||
Font aFont( GetFont() );
|
||||
aFont.SetColor( rStyleSettings.GetWindowTextColor() );
|
||||
SetFont( aFont );
|
||||
|
||||
Invalidate(INVALIDATE_NOCHILDREN);
|
||||
}
|
||||
}
|
||||
void SvtIconChoiceCtrl::Flush()
|
||||
{
|
||||
_pImp->Flush();
|
||||
}
|
||||
void SvtIconChoiceCtrl::RequestHelp( const HelpEvent& rHEvt )
|
||||
{
|
||||
if( !_pImp->RequestHelp( rHEvt ) )
|
||||
Control::RequestHelp( rHEvt );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,589 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: templwin.cxx,v $
|
||||
*
|
||||
* $Revision: 1.1 $
|
||||
*
|
||||
* last change: $Author: pb $ $Date: 2001-05-07 10:33:55 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1
|
||||
* - Sun Industry Standards Source License Version 1.1
|
||||
*
|
||||
* Sun Microsystems Inc., October, 2000
|
||||
*
|
||||
* GNU Lesser General Public License Version 2.1
|
||||
* =============================================
|
||||
* Copyright 2000 by Sun Microsystems, Inc.
|
||||
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library 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 for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Sun Industry Standards Source License Version 1.1
|
||||
* =================================================
|
||||
* The contents of this file are subject to the Sun Industry Standards
|
||||
* Source License Version 1.1 (the "License"); You may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of the
|
||||
* License at http://www.openoffice.org/license.html.
|
||||
*
|
||||
* Software provided under this License is provided on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||
* See the License for the specific provisions governing your rights and
|
||||
* obligations concerning the Software.
|
||||
*
|
||||
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||
*
|
||||
* Copyright: 2000 by Sun Microsystems, Inc.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): _______________________________________
|
||||
*
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#include "templwin.hxx"
|
||||
#include "templdlg.hxx"
|
||||
#include "svtdata.hxx"
|
||||
|
||||
#include "svtools.hrc"
|
||||
#include "templwin.hrc"
|
||||
#include "helpid.hrc"
|
||||
|
||||
#ifndef _UNOTOOLS_UCBHELPER_HXX
|
||||
#include <unotools/ucbhelper.hxx>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
|
||||
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_
|
||||
#include <com/sun/star/frame/XFrame.hpp>
|
||||
#endif
|
||||
#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
|
||||
#include <toolkit/helper/vclunohelper.hxx>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_UTIL_URL_HPP_
|
||||
#include <com/sun/star/util/URL.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_UTIL_XURLTRANSFORMER_HPP_
|
||||
#include <com/sun/star/util/XURLTransformer.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_FRAME_XDISPATCH_HPP_
|
||||
#include <com/sun/star/frame/XDispatch.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_FRAME_XDISPATCHPROVIDER_HPP_
|
||||
#include <com/sun/star/frame/XDispatchProvider.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_FRAME_XDOCUMENTTEMPLATES_HPP_
|
||||
#include <com/sun/star/frame/XDocumentTemplates.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_FRAME_XCOMPONENTLOADER_HPP_
|
||||
#include <com/sun/star/frame/XComponentLoader.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_LANG_XLOCALIZABLE_HPP_
|
||||
#include <com/sun/star/lang/XLocalizable.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_
|
||||
#include <com/sun/star/lang/Locale.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
|
||||
#include <com/sun/star/beans/PropertyValue.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_UCB_XCONTENT_HPP_
|
||||
#include <com/sun/star/ucb/XContent.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_UCB_XCOMMANDENVIRONMENT_HPP_
|
||||
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_VIEW_XPRINTABLE_HPP_
|
||||
#include <com/sun/star/view/XPrintable.hpp>
|
||||
#endif
|
||||
|
||||
#include <comphelper/processfactory.hxx>
|
||||
#include <tools/urlobj.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/split.hxx>
|
||||
#include <vcl/msgbox.hxx>
|
||||
#include <svtools/pathoptions.hxx>
|
||||
|
||||
using namespace ::com::sun::star::beans;
|
||||
using namespace ::com::sun::star::frame;
|
||||
using namespace ::com::sun::star::lang;
|
||||
using namespace ::com::sun::star::ucb;
|
||||
using namespace ::com::sun::star::uno;
|
||||
using namespace ::com::sun::star::util;
|
||||
using namespace ::com::sun::star::view;
|
||||
|
||||
#define SPLITSET_ID 0
|
||||
#define COLSET_ID 1
|
||||
#define ICONWIN_ID 2
|
||||
#define FILEWIN_ID 3
|
||||
#define FRAMEWIN_ID 4
|
||||
|
||||
// class SvtIconWindow_Impl ----------------------------------------------
|
||||
|
||||
SvtIconWindow_Impl::SvtIconWindow_Impl( Window* pParent ) :
|
||||
|
||||
Window( pParent ),
|
||||
|
||||
aIconCtrl( this, WB_3DLOOK | WB_ICON | WB_NOCOLUMNHEADER |
|
||||
WB_HIGHLIGHTFRAME | WB_NOSELECTION | WB_NODRAGSELECTION | WB_TABSTOP ),
|
||||
nMaxTextLength( 0 )
|
||||
|
||||
{
|
||||
aIconCtrl.SetStyle( WB_3DLOOK | WB_ICON | WB_NOCOLUMNHEADER | WB_HIGHLIGHTFRAME |
|
||||
WB_NOSELECTION | WB_NODRAGSELECTION | WB_TABSTOP | WB_CLIPCHILDREN );
|
||||
const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
|
||||
Wallpaper aWallpaper ( rStyles.GetWorkspaceColor() );
|
||||
aIconCtrl.SetBackground( aWallpaper );
|
||||
aIconCtrl.SetFontColorToBackground ();
|
||||
aIconCtrl.SetHelpId( HID_TEMPLATEDLG_ICONCTRL );
|
||||
aIconCtrl.Show();
|
||||
|
||||
// detect the root URL of templates
|
||||
::rtl::OUString aService = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.DocumentTemplates" ) );
|
||||
Reference< XDocumentTemplates > xTemplates(
|
||||
::comphelper::getProcessServiceFactory()->createInstance( aService ), UNO_QUERY );
|
||||
|
||||
if ( xTemplates.is() )
|
||||
{
|
||||
AllSettings aSettings;
|
||||
Locale aLocale = aSettings.GetLocale();
|
||||
|
||||
Reference< XLocalizable > xLocalizable( xTemplates, UNO_QUERY );
|
||||
xLocalizable->setLocale( aLocale );
|
||||
|
||||
Reference < XContent > aRootContent = xTemplates->getContent();
|
||||
Reference < XCommandEnvironment > aCmdEnv;
|
||||
|
||||
if ( aRootContent.is() )
|
||||
aTemplateRootURL = aRootContent->getIdentifier()->getContentIdentifier();
|
||||
}
|
||||
|
||||
// insert the categories
|
||||
// "New Document"
|
||||
String aEntryStr = String( SvtResId( STR_SVT_NEWDOC ) );
|
||||
nMaxTextLength = GetTextWidth( aEntryStr );
|
||||
SvxIconChoiceCtrlEntry* pEntry =
|
||||
aIconCtrl.InsertEntry( aEntryStr, Image( SvtResId( IMG_SVT_NEWDOC ) ) );
|
||||
String* pURL = new String();
|
||||
pEntry->SetUserData( pURL );
|
||||
long nTemp = 0;
|
||||
|
||||
// "Templates"
|
||||
if ( aTemplateRootURL.Len() > 0 )
|
||||
{
|
||||
aEntryStr = String( SvtResId( STR_SVT_TEMPLATES ) );
|
||||
nTemp = GetTextWidth( aEntryStr );
|
||||
if ( nTemp > nMaxTextLength )
|
||||
nMaxTextLength = nTemp;
|
||||
pEntry = aIconCtrl.InsertEntry( aEntryStr, Image( SvtResId( IMG_SVT_TEMPLATES ) ) );
|
||||
pURL = new String( aTemplateRootURL );
|
||||
pEntry->SetUserData( pURL );
|
||||
}
|
||||
|
||||
// "My Documents"
|
||||
aEntryStr = String( SvtResId( STR_SVT_MYDOCS ) );
|
||||
nTemp = GetTextWidth( aEntryStr );
|
||||
if ( nTemp > nMaxTextLength )
|
||||
nMaxTextLength = nTemp;
|
||||
pEntry = aIconCtrl.InsertEntry( aEntryStr, Image( SvtResId( IMG_SVT_MYDOCS ) ) );
|
||||
pURL = new String( SvtPathOptions().GetWorkPath() );
|
||||
pEntry->SetUserData( pURL );
|
||||
|
||||
// "Samples"
|
||||
aEntryStr = String( SvtResId( STR_SVT_SAMPLES ) );
|
||||
nTemp = GetTextWidth( aEntryStr );
|
||||
if ( nTemp > nMaxTextLength )
|
||||
nMaxTextLength = nTemp;
|
||||
pEntry = aIconCtrl.InsertEntry( aEntryStr, Image( SvtResId( IMG_SVT_SAMPLES ) ) );
|
||||
String aPath( RTL_CONSTASCII_USTRINGPARAM("$(insturl)/share/samples/$(vlang)") );
|
||||
pURL = new String( SvtPathOptions().SubstituteVariable( aPath ) );
|
||||
pEntry->SetUserData( pURL );
|
||||
}
|
||||
|
||||
SvtIconWindow_Impl::~SvtIconWindow_Impl()
|
||||
{
|
||||
for ( ULONG i = 0; i < aIconCtrl.GetEntryCount(); ++i )
|
||||
{
|
||||
SvxIconChoiceCtrlEntry* pEntry = aIconCtrl.GetEntry( i );
|
||||
delete (String*)pEntry->GetUserData();
|
||||
}
|
||||
}
|
||||
|
||||
void SvtIconWindow_Impl::Resize()
|
||||
{
|
||||
Size aWinSize = GetOutputSizePixel();
|
||||
aIconCtrl.SetSizePixel( aWinSize );
|
||||
aIconCtrl.ArrangeIcons();
|
||||
}
|
||||
|
||||
String SvtIconWindow_Impl::GetSelectedIconURL() const
|
||||
{
|
||||
ULONG nPos;
|
||||
SvxIconChoiceCtrlEntry* pEntry = aIconCtrl.GetSelectedEntry( nPos );
|
||||
String aURL = *(String*)pEntry->GetUserData();
|
||||
return aURL;
|
||||
}
|
||||
|
||||
// class SvtFileViewWindow_Impl -----------------------------------------_
|
||||
|
||||
SvtFileViewWindow_Impl::SvtFileViewWindow_Impl( Window* pParent ) :
|
||||
|
||||
Window( pParent ),
|
||||
|
||||
aFileView ( this, SvtResId( CTRL_FILEVIEW ), sal_False, sal_False ),
|
||||
bIsTemplateFolder ( sal_False )
|
||||
|
||||
{
|
||||
aFileView.SetHelpId( HID_TEMPLATEDLG_FILEVIEW );
|
||||
aFileView.Show();
|
||||
aFileView.SetPosPixel( Point( 0, 0 ) );
|
||||
}
|
||||
|
||||
SvtFileViewWindow_Impl::~SvtFileViewWindow_Impl()
|
||||
{
|
||||
}
|
||||
|
||||
void SvtFileViewWindow_Impl::Resize()
|
||||
{
|
||||
Size aWinSize = GetSizePixel();
|
||||
aFileView.SetSizePixel( aWinSize );
|
||||
}
|
||||
|
||||
String SvtFileViewWindow_Impl::GetSelectedFile() const
|
||||
{
|
||||
return aFileView.GetCurrentURL();
|
||||
}
|
||||
|
||||
void SvtFileViewWindow_Impl::OpenFolder( const String& rURL )
|
||||
{
|
||||
bIsTemplateFolder = ( INetURLObject( rURL ).GetProtocol() == INET_PROT_VND_SUN_STAR_HIER );
|
||||
aFileView.Initialize( rURL, String() );
|
||||
aNewFolderLink.Call( this );
|
||||
}
|
||||
|
||||
sal_Bool SvtFileViewWindow_Impl::HasPreviousLevel( String& rURL ) const
|
||||
{
|
||||
return ( INetURLObject( aFileView.GetViewURL() ) != INetURLObject( aCurrentRootURL ) &&
|
||||
aFileView.HasPreviousLevel( rURL ) );
|
||||
}
|
||||
|
||||
// class SvtFrameWindow_Impl ---------------------------------------------
|
||||
|
||||
SvtFrameWindow_Impl::SvtFrameWindow_Impl( Window* pParent ) :
|
||||
|
||||
Window( pParent )
|
||||
|
||||
{
|
||||
pTextWin = new Window( this );
|
||||
pTextWin->Show();
|
||||
xFrame = ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame > (
|
||||
::comphelper::getProcessServiceFactory()->createInstance(
|
||||
String( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Frame") ) ), ::com::sun::star::uno::UNO_QUERY );
|
||||
xFrame->initialize( VCLUnoHelper::GetInterface ( pTextWin ) );
|
||||
}
|
||||
|
||||
SvtFrameWindow_Impl::~SvtFrameWindow_Impl()
|
||||
{
|
||||
xFrame->dispose();
|
||||
}
|
||||
|
||||
void SvtFrameWindow_Impl::Resize()
|
||||
{
|
||||
Size aWinSize = GetOutputSizePixel();
|
||||
pTextWin->SetSizePixel( aWinSize );
|
||||
}
|
||||
|
||||
void SvtFrameWindow_Impl::OpenFile( const String& rURL, sal_Bool bPreview, sal_Bool bAsTemplate )
|
||||
{
|
||||
if ( rURL.Len() == 0 || !::utl::UCBContentHelper::IsFolder( rURL ) )
|
||||
{
|
||||
URL aURL;
|
||||
aURL.Complete = rURL;
|
||||
Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance(
|
||||
String( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer" ) ) ), UNO_QUERY );
|
||||
xTrans->parseStrict( aURL );
|
||||
|
||||
String aTarget;
|
||||
if ( bPreview )
|
||||
aTarget = String( RTL_CONSTASCII_USTRINGPARAM("_self") );
|
||||
else
|
||||
aTarget = String( RTL_CONSTASCII_USTRINGPARAM("_blank") );
|
||||
Reference < XDispatchProvider > xProv( xFrame, UNO_QUERY );
|
||||
Reference < XDispatch > xDisp = xProv.is() ?
|
||||
xProv->queryDispatch( aURL, aTarget, 0 ) : Reference < XDispatch >();
|
||||
|
||||
if ( xDisp.is() )
|
||||
{
|
||||
if ( bPreview )
|
||||
{
|
||||
Sequence < PropertyValue > aArgs( 2 );
|
||||
aArgs[0].Name = String( RTL_CONSTASCII_USTRINGPARAM("Preview") );
|
||||
aArgs[0].Value <<= sal_True;
|
||||
aArgs[1].Name = String( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") );
|
||||
aArgs[1].Value <<= sal_True;
|
||||
xDisp->dispatch( aURL, aArgs );
|
||||
}
|
||||
else if ( bAsTemplate )
|
||||
{
|
||||
Sequence < PropertyValue > aArgs( 1 );
|
||||
aArgs[0].Name = String( RTL_CONSTASCII_USTRINGPARAM("AsTemplate") );
|
||||
aArgs[0].Value <<= sal_True;
|
||||
xDisp->dispatch( aURL, aArgs );
|
||||
}
|
||||
else
|
||||
xDisp->dispatch( aURL, Sequence < PropertyValue >() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// class SvtTemplateWindow -----------------------------------------------
|
||||
|
||||
SvtTemplateWindow::SvtTemplateWindow( Window* pParent ) :
|
||||
|
||||
Window( pParent, WB_3DLOOK ),
|
||||
|
||||
aToolBox ( this, SvtResId( 1001 ) ),
|
||||
aSplitWin ( this, WB_DOCKBORDER )
|
||||
|
||||
{
|
||||
pIconWin = new SvtIconWindow_Impl( this );
|
||||
pIconWin->SetClickHdl( LINK( this, SvtTemplateWindow, IconClickHdl_Impl ) );
|
||||
pIconWin->Show();
|
||||
pFileWin = new SvtFileViewWindow_Impl( this );
|
||||
pFileWin->SetSelectHdl( LINK( this, SvtTemplateWindow, FileSelectHdl_Impl ) );
|
||||
pFileWin->SetDoubleClickHdl( LINK( this, SvtTemplateWindow, FileDblClickHdl_Impl ) );
|
||||
pFileWin->SetNewFolderHdl( LINK( this, SvtTemplateWindow, NewFolderHdl_Impl ) );
|
||||
pFileWin->Show();
|
||||
pFrameWin = new SvtFrameWindow_Impl( this );
|
||||
pFrameWin->Show();
|
||||
|
||||
aSplitWin.SetAlign( WINDOWALIGN_LEFT );
|
||||
long nWidth = ( pIconWin->GetMaxTextLength() * 3 / 2 );
|
||||
aSplitWin.InsertItem( ICONWIN_ID, pIconWin, nWidth, SPLITWINDOW_APPEND, 0, SWIB_FIXED );
|
||||
aSplitWin.InsertItem( FILEWIN_ID, pFileWin, 50, SPLITWINDOW_APPEND, 0, SWIB_PERCENTSIZE );
|
||||
aSplitWin.InsertItem( FRAMEWIN_ID, pFrameWin, 50, SPLITWINDOW_APPEND, 0, SWIB_PERCENTSIZE );
|
||||
|
||||
SetSizePixel( Size( 1000, 600 ) );
|
||||
|
||||
aResetTimer.SetTimeout( 100 );
|
||||
aResetTimer.SetTimeoutHdl( LINK( this, SvtTemplateWindow, ResetHdl_Impl ) );
|
||||
aSelectTimer.SetTimeout( 200 );
|
||||
aSelectTimer.SetTimeoutHdl( LINK( this, SvtTemplateWindow, TimeoutHdl_Impl ) );
|
||||
|
||||
Size aSize = aToolBox.CalcWindowSizePixel();
|
||||
aToolBox.SetPosSizePixel( Point(), aSize );
|
||||
aToolBox.SetOutStyle( TOOLBOX_STYLE_FLAT );
|
||||
aToolBox.SetClickHdl( LINK( this, SvtTemplateWindow, ClickHdl_Impl ) );
|
||||
aToolBox.EnableItem( TI_DOCTEMPLATE_PREV, FALSE );
|
||||
aToolBox.Show();
|
||||
|
||||
aSplitWin.Show();
|
||||
String aRootURL = pIconWin->GetTemplateRootURL();
|
||||
if ( aRootURL.Len() > 0 )
|
||||
pFileWin->OpenRoot( aRootURL );
|
||||
}
|
||||
|
||||
SvtTemplateWindow::~SvtTemplateWindow()
|
||||
{
|
||||
delete pIconWin;
|
||||
delete pFileWin;
|
||||
delete pFrameWin;
|
||||
}
|
||||
|
||||
IMPL_LINK ( SvtTemplateWindow , IconClickHdl_Impl, SvtIconChoiceCtrl *, pCtrl )
|
||||
{
|
||||
String aURL = pIconWin->GetSelectedIconURL();
|
||||
pFileWin->OpenRoot( aURL );
|
||||
return 0;
|
||||
}
|
||||
|
||||
IMPL_LINK ( SvtTemplateWindow , FileSelectHdl_Impl, SvtFileView *, pView )
|
||||
{
|
||||
aSelectTimer.Start();
|
||||
return 0;
|
||||
}
|
||||
|
||||
IMPL_LINK ( SvtTemplateWindow , FileDblClickHdl_Impl, SvtFileView *, pView )
|
||||
{
|
||||
if ( aSelectTimer.IsActive() )
|
||||
aSelectTimer.Stop();
|
||||
|
||||
String aURL = pFileWin->GetSelectedFile();
|
||||
if ( ::utl::UCBContentHelper::IsFolder( aURL ) )
|
||||
{
|
||||
pFileWin->OpenFolder( aURL );
|
||||
aResetTimer.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
pFrameWin->OpenFile( aURL, sal_False, pFileWin->IsTemplateFolder() );
|
||||
aDoubleClickHdl.Call( this );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
IMPL_LINK ( SvtTemplateWindow , NewFolderHdl_Impl, SvtFileView *, pView )
|
||||
{
|
||||
String aTemp;
|
||||
aToolBox.EnableItem( TI_DOCTEMPLATE_PREV, pFileWin->HasPreviousLevel( aTemp ) );
|
||||
pFrameWin->OpenFile( String(), sal_True, sal_False );
|
||||
return 0;
|
||||
}
|
||||
|
||||
IMPL_LINK ( SvtTemplateWindow , ResetHdl_Impl, Timer *, EMPTYARG )
|
||||
{
|
||||
pFileWin->ResetCursor();
|
||||
aSelectHdl.Call( this );
|
||||
return 0;
|
||||
}
|
||||
|
||||
IMPL_LINK ( SvtTemplateWindow , TimeoutHdl_Impl, Timer *, EMPTYARG )
|
||||
{
|
||||
aSelectHdl.Call( this );
|
||||
String aURL = pFileWin->GetSelectedFile();
|
||||
sal_Bool bIsFolder = ::utl::UCBContentHelper::IsFolder( aURL );
|
||||
aToolBox.EnableItem( TI_DOCTEMPLATE_PRINT, !bIsFolder );
|
||||
if ( !bIsFolder )
|
||||
pFrameWin->OpenFile( aURL, sal_True, sal_False );
|
||||
return 0;
|
||||
}
|
||||
|
||||
IMPL_LINK ( SvtTemplateWindow , ClickHdl_Impl, ToolBox *, EMPTYARG )
|
||||
{
|
||||
switch( aToolBox.GetCurItemId() )
|
||||
{
|
||||
case TI_DOCTEMPLATE_BACK :
|
||||
break;
|
||||
|
||||
case TI_DOCTEMPLATE_PREV :
|
||||
{
|
||||
String aURL;
|
||||
if ( pFileWin->HasPreviousLevel( aURL ) )
|
||||
pFileWin->OpenFolder( aURL );
|
||||
break;
|
||||
}
|
||||
|
||||
case TI_DOCTEMPLATE_PRINT :
|
||||
{
|
||||
PrintFile( pFileWin->GetSelectedFile() );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SvtTemplateWindow::PrintFile( const String& rURL )
|
||||
{
|
||||
// open the file readonly and hidden
|
||||
Sequence < PropertyValue > aArgs( 2 );
|
||||
aArgs[0].Name = String( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") );
|
||||
aArgs[0].Value <<= sal_True;
|
||||
aArgs[1].Name = String( RTL_CONSTASCII_USTRINGPARAM("Hidden") );
|
||||
aArgs[1].Value <<= sal_True;
|
||||
|
||||
Reference < XComponentLoader > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop")), UNO_QUERY );
|
||||
Reference < XModel > xModel( xDesktop->loadComponentFromURL( rURL, ::rtl::OUString::createFromAscii("_blank"), 0, aArgs ), UNO_QUERY );
|
||||
if ( xModel.is() )
|
||||
{
|
||||
// print
|
||||
Reference < XPrintable > xPrintable( xModel, UNO_QUERY );
|
||||
if ( xPrintable.is() )
|
||||
xPrintable->print( Sequence < PropertyValue >() );
|
||||
}
|
||||
}
|
||||
|
||||
void SvtTemplateWindow::Resize()
|
||||
{
|
||||
long nIconWinWidth = aSplitWin.GetItemSize( ICONWIN_ID );
|
||||
nIconWinWidth += ( Splitter( this, 0 ).GetSizePixel().Width() / 2);
|
||||
Size aWinSize = GetOutputSizePixel();
|
||||
Size aSize = aToolBox.GetSizePixel();
|
||||
aSize.Width() = aWinSize.Width() - nIconWinWidth;
|
||||
aToolBox.SetSizePixel( aSize );
|
||||
Point aPos = aToolBox.GetPosPixel();
|
||||
aPos.X() = nIconWinWidth;
|
||||
aToolBox.SetPosPixel( aPos );
|
||||
|
||||
long nToolBoxHeight = aSize.Height();
|
||||
aSize = aWinSize;
|
||||
aSize.Height() -= nToolBoxHeight;
|
||||
aSplitWin.SetPosSizePixel( Point( 0, nToolBoxHeight ), aSize );
|
||||
}
|
||||
|
||||
sal_Bool SvtTemplateWindow::IsFileSelected() const
|
||||
{
|
||||
String aURL = pFileWin->GetSelectedFile();
|
||||
sal_Bool bRet = ( aURL.Len() > 0 && !::utl::UCBContentHelper::IsFolder( aURL ) );
|
||||
return bRet;
|
||||
}
|
||||
|
||||
// class SvtDocumentTemplateDialog ---------------------------------------
|
||||
|
||||
SvtDocumentTemplateDialog::SvtDocumentTemplateDialog( Window* pParent ) :
|
||||
|
||||
ModalDialog( pParent, SvtResId( DLG_DOCTEMPLATE ) ),
|
||||
|
||||
aLine ( this, ResId( FL_DOCTEMPLATE ) ),
|
||||
aManageBtn ( this, ResId( BTN_DOCTEMPLATE_MANAGE ) ),
|
||||
aEditBtn ( this, ResId( BTN_DOCTEMPLATE_EDIT ) ),
|
||||
aOKBtn ( this, ResId( BTN_DOCTEMPLATE_OPEN ) ),
|
||||
aCancelBtn ( this, ResId( BTN_DOCTEMPLATE_CANCEL ) ),
|
||||
aHelpBtn ( this, ResId( BTN_DOCTEMPLATE_HELP ) )
|
||||
|
||||
{
|
||||
FreeResource();
|
||||
|
||||
pWin = new SvtTemplateWindow( this );
|
||||
Size aSize = GetOutputSizePixel();
|
||||
Point aPos = aLine.GetPosPixel();
|
||||
Size a6Size = LogicToPixel( Size( 6, 6 ), MAP_APPFONT );
|
||||
aSize.Height() = aPos.Y() - a6Size.Height();
|
||||
|
||||
pWin->SetSelectHdl( LINK( this, SvtDocumentTemplateDialog, SelectHdl_Impl ) );
|
||||
pWin->SetDoubleClickHdl( LINK( this, SvtDocumentTemplateDialog, DoubleClickHdl_Impl ) );
|
||||
|
||||
pWin->SetPosSizePixel( Point( 0, 0 ), aSize );
|
||||
pWin->Show();
|
||||
|
||||
SelectHdl_Impl( NULL );
|
||||
}
|
||||
|
||||
SvtDocumentTemplateDialog::~SvtDocumentTemplateDialog()
|
||||
{
|
||||
delete pWin;
|
||||
}
|
||||
|
||||
IMPL_LINK ( SvtDocumentTemplateDialog , SelectHdl_Impl, SvtTemplateWindow *, EMPTYARG )
|
||||
{
|
||||
sal_Bool bEnable = pWin->IsFileSelected();
|
||||
aEditBtn.Enable( bEnable );
|
||||
aOKBtn.Enable( bEnable );
|
||||
return 0;
|
||||
}
|
||||
|
||||
IMPL_LINK ( SvtDocumentTemplateDialog , DoubleClickHdl_Impl, SvtTemplateWindow *, EMPTYARG )
|
||||
{
|
||||
EndDialog( RET_OK );
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: templwin.hrc,v $
|
||||
*
|
||||
* $Revision: 1.1 $
|
||||
*
|
||||
* last change: $Author: pb $ $Date: 2001-05-07 10:33:55 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1
|
||||
* - Sun Industry Standards Source License Version 1.1
|
||||
*
|
||||
* Sun Microsystems Inc., October, 2000
|
||||
*
|
||||
* GNU Lesser General Public License Version 2.1
|
||||
* =============================================
|
||||
* Copyright 2000 by Sun Microsystems, Inc.
|
||||
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library 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 for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Sun Industry Standards Source License Version 1.1
|
||||
* =================================================
|
||||
* The contents of this file are subject to the Sun Industry Standards
|
||||
* Source License Version 1.1 (the "License"); You may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of the
|
||||
* License at http://www.openoffice.org/license.html.
|
||||
*
|
||||
* Software provided under this License is provided on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||
* See the License for the specific provisions governing your rights and
|
||||
* obligations concerning the Software.
|
||||
*
|
||||
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||
*
|
||||
* Copyright: 2000 by Sun Microsystems, Inc.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): _______________________________________
|
||||
*
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#define FL_DOCTEMPLATE 10
|
||||
#define BTN_DOCTEMPLATE_MANAGE 11
|
||||
#define BTN_DOCTEMPLATE_EDIT 12
|
||||
#define BTN_DOCTEMPLATE_OPEN 13
|
||||
#define BTN_DOCTEMPLATE_CANCEL 14
|
||||
#define BTN_DOCTEMPLATE_HELP 15
|
||||
|
||||
#define TI_DOCTEMPLATE_BACK 1
|
||||
#define TI_DOCTEMPLATE_PREV 2
|
||||
#define TI_DOCTEMPLATE_PRINT 3
|
||||
|
||||
@@ -0,0 +1,197 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: templwin.hxx,v $
|
||||
*
|
||||
* $Revision: 1.1 $
|
||||
*
|
||||
* last change: $Author: pb $ $Date: 2001-05-07 10:33:55 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1
|
||||
* - Sun Industry Standards Source License Version 1.1
|
||||
*
|
||||
* Sun Microsystems Inc., October, 2000
|
||||
*
|
||||
* GNU Lesser General Public License Version 2.1
|
||||
* =============================================
|
||||
* Copyright 2000 by Sun Microsystems, Inc.
|
||||
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library 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 for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Sun Industry Standards Source License Version 1.1
|
||||
* =================================================
|
||||
* The contents of this file are subject to the Sun Industry Standards
|
||||
* Source License Version 1.1 (the "License"); You may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of the
|
||||
* License at http://www.openoffice.org/license.html.
|
||||
*
|
||||
* Software provided under this License is provided on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||
* See the License for the specific provisions governing your rights and
|
||||
* obligations concerning the Software.
|
||||
*
|
||||
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||
*
|
||||
* Copyright: 2000 by Sun Microsystems, Inc.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): _______________________________________
|
||||
*
|
||||
*
|
||||
************************************************************************/
|
||||
#ifndef _SVTOOLS_TEMPLWIN_HXX
|
||||
#define _SVTOOLS_TEMPLWIN_HXX
|
||||
|
||||
namespace com
|
||||
{
|
||||
namespace sun
|
||||
{
|
||||
namespace star
|
||||
{
|
||||
namespace frame
|
||||
{
|
||||
class XFrame;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#include <vcl/window.hxx>
|
||||
#include <vcl/toolbox.hxx>
|
||||
#include <vcl/splitwin.hxx>
|
||||
|
||||
#include "ivctrl.hxx"
|
||||
#include "fileview.hxx"
|
||||
|
||||
// class SvtIconWindow_Impl ----------------------------------------------
|
||||
|
||||
class SvtIconWindow_Impl : public Window
|
||||
{
|
||||
private:
|
||||
SvtIconChoiceCtrl aIconCtrl;
|
||||
String aTemplateRootURL;
|
||||
long nMaxTextLength;
|
||||
|
||||
public:
|
||||
SvtIconWindow_Impl( Window* pParent );
|
||||
~SvtIconWindow_Impl();
|
||||
|
||||
virtual void Resize();
|
||||
|
||||
long GetMaxTextLength() const { return nMaxTextLength; }
|
||||
void SetClickHdl( const Link& rLink ) { aIconCtrl.SetClickHdl( rLink ); }
|
||||
|
||||
String GetSelectedIconURL() const;
|
||||
String GetTemplateRootURL() const { return aTemplateRootURL; }
|
||||
};
|
||||
|
||||
// class SvtFileViewWindow_Impl -----------------------------------------_
|
||||
|
||||
class SvtFileViewWindow_Impl : public Window
|
||||
{
|
||||
private:
|
||||
SvtFileView aFileView;
|
||||
Link aNewFolderLink;
|
||||
String aCurrentRootURL;
|
||||
|
||||
sal_Bool bIsTemplateFolder;
|
||||
|
||||
public:
|
||||
SvtFileViewWindow_Impl( Window* pParent );
|
||||
~SvtFileViewWindow_Impl();
|
||||
|
||||
virtual void Resize();
|
||||
|
||||
void SetSelectHdl( const Link& rLink ) { aFileView.SetSelectHdl( rLink ); }
|
||||
void SetDoubleClickHdl( const Link& rLink ) { aFileView.SetDoubleClickHdl( rLink ); }
|
||||
void SetNewFolderHdl( const Link& rLink ) { aNewFolderLink = rLink; }
|
||||
void ResetCursor() { aFileView.ResetCursor(); }
|
||||
sal_Bool IsTemplateFolder() const { return bIsTemplateFolder; }
|
||||
|
||||
String GetSelectedFile() const;
|
||||
void OpenFolder( const String& rURL );
|
||||
void OpenRoot( const String& rRootURL )
|
||||
{ aCurrentRootURL = rRootURL; OpenFolder( rRootURL ); }
|
||||
sal_Bool HasPreviousLevel( String& rURL ) const;
|
||||
};
|
||||
|
||||
// class SvtFrameWindow_Impl ---------------------------------------------
|
||||
|
||||
class SvtFrameWindow_Impl : public Window
|
||||
{
|
||||
private:
|
||||
Window* pTextWin;
|
||||
::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame >
|
||||
xFrame;
|
||||
|
||||
public:
|
||||
SvtFrameWindow_Impl( Window* pParent );
|
||||
~SvtFrameWindow_Impl();
|
||||
|
||||
virtual void Resize();
|
||||
|
||||
void OpenFile( const String& rURL, sal_Bool bPreview, sal_Bool bAsTemplate );
|
||||
};
|
||||
|
||||
// class SvtTemplateWindow -----------------------------------------------
|
||||
|
||||
class SvtTemplateWindow : public Window
|
||||
{
|
||||
private:
|
||||
ToolBox aToolBox;
|
||||
SplitWindow aSplitWin;
|
||||
|
||||
SvtIconWindow_Impl* pIconWin;
|
||||
SvtFileViewWindow_Impl* pFileWin;
|
||||
SvtFrameWindow_Impl* pFrameWin;
|
||||
|
||||
Link aSelectHdl;
|
||||
Link aDoubleClickHdl;
|
||||
|
||||
Timer aSelectTimer;
|
||||
Timer aResetTimer;
|
||||
|
||||
virtual void Resize();
|
||||
|
||||
DECL_LINK( IconClickHdl_Impl, SvtIconChoiceCtrl* );
|
||||
DECL_LINK( FileSelectHdl_Impl, SvtFileView* );
|
||||
DECL_LINK( FileDblClickHdl_Impl, SvtFileView* );
|
||||
DECL_LINK( NewFolderHdl_Impl, SvtFileView* );
|
||||
DECL_LINK( ResetHdl_Impl, Timer* );
|
||||
DECL_LINK( TimeoutHdl_Impl, Timer* );
|
||||
DECL_LINK( ClickHdl_Impl, ToolBox* );
|
||||
|
||||
void PrintFile( const String& rURL );
|
||||
|
||||
public:
|
||||
SvtTemplateWindow( Window* pParent );
|
||||
~SvtTemplateWindow();
|
||||
|
||||
void SetSelectHdl( const Link& rLink ) { aSelectHdl = rLink; }
|
||||
void SetDoubleClickHdl( const Link& rLink ) { aDoubleClickHdl = rLink; }
|
||||
|
||||
sal_Bool IsFileSelected() const;
|
||||
};
|
||||
|
||||
#endif // _SVTOOLS_TEMPLWIN_HXX
|
||||
|
||||
@@ -0,0 +1,210 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $RCSfile: templwin.src,v $
|
||||
*
|
||||
* $Revision: 1.1 $
|
||||
*
|
||||
* last change: $Author: pb $ $Date: 2001-05-07 10:33:55 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1
|
||||
* - Sun Industry Standards Source License Version 1.1
|
||||
*
|
||||
* Sun Microsystems Inc., October, 2000
|
||||
*
|
||||
* GNU Lesser General Public License Version 2.1
|
||||
* =============================================
|
||||
* Copyright 2000 by Sun Microsystems, Inc.
|
||||
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library 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 for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* Sun Industry Standards Source License Version 1.1
|
||||
* =================================================
|
||||
* The contents of this file are subject to the Sun Industry Standards
|
||||
* Source License Version 1.1 (the "License"); You may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of the
|
||||
* License at http://www.openoffice.org/license.html.
|
||||
*
|
||||
* Software provided under this License is provided on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||
* See the License for the specific provisions governing your rights and
|
||||
* obligations concerning the Software.
|
||||
*
|
||||
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||
*
|
||||
* Copyright: 2000 by Sun Microsystems, Inc.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): _______________________________________
|
||||
*
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
// includes ------------------------------------------------------------------
|
||||
|
||||
#include "svtools.hrc"
|
||||
#include "templwin.hrc"
|
||||
#include "helpid.hrc"
|
||||
|
||||
#define MASK_COL Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
|
||||
|
||||
Control CTRL_FILEVIEW
|
||||
{
|
||||
Pos = MAP_APPFONT ( 0 , 0 ) ;
|
||||
Size = MAP_APPFONT ( 200 , 180 ) ;
|
||||
};
|
||||
|
||||
String STR_SVT_NEWDOC
|
||||
{
|
||||
Text = "Neues Dokument";
|
||||
Text [ english_us ] = "New Document";
|
||||
};
|
||||
|
||||
Image IMG_SVT_NEWDOC
|
||||
{
|
||||
ImageBitmap = Bitmap { File = "new_doc.bmp" ; };
|
||||
MaskColor = MASK_COL
|
||||
};
|
||||
|
||||
String STR_SVT_MYDOCS
|
||||
{
|
||||
Text = "Eigene Dateien";
|
||||
Text [ english_us ] = "My Documents";
|
||||
};
|
||||
|
||||
Image IMG_SVT_MYDOCS
|
||||
{
|
||||
ImageBitmap = Bitmap { File = "my_docs.bmp" ; };
|
||||
MaskColor = MASK_COL
|
||||
};
|
||||
|
||||
String STR_SVT_TEMPLATES
|
||||
{
|
||||
Text = "Vorlagen";
|
||||
Text [ english_us ] = "Templates";
|
||||
};
|
||||
|
||||
Image IMG_SVT_TEMPLATES
|
||||
{
|
||||
ImageBitmap = Bitmap { File = "template.bmp" ; };
|
||||
MaskColor = MASK_COL
|
||||
};
|
||||
|
||||
String STR_SVT_SAMPLES
|
||||
{
|
||||
Text = "Beispiele";
|
||||
Text [ english_us ] = "Samples";
|
||||
};
|
||||
|
||||
Image IMG_SVT_SAMPLES
|
||||
{
|
||||
ImageBitmap = Bitmap { File = "samples.bmp" ; };
|
||||
MaskColor = MASK_COL
|
||||
};
|
||||
|
||||
ToolBox 1001
|
||||
{
|
||||
Pos = MAP_APPFONT ( 0 , 0 ) ;
|
||||
Size = MAP_APPFONT ( 100 , 12 ) ;
|
||||
ItemList =
|
||||
{
|
||||
ToolBoxItem
|
||||
{
|
||||
Identifier = TI_DOCTEMPLATE_BACK;
|
||||
ItemBitmap = Bitmap { File = "back_small.bmp" ; };
|
||||
Text = "Zurück" ;
|
||||
Text [ english_us ] = "Back" ;
|
||||
Text[ language_user1 ] = " ";
|
||||
};
|
||||
ToolBoxItem
|
||||
{
|
||||
Identifier = TI_DOCTEMPLATE_PREV;
|
||||
ItemBitmap = Bitmap { File = "up_small.bmp" ; };
|
||||
Text = "Eine Ebene höher" ;
|
||||
Text [ english_us ] = "Higher" ;
|
||||
Text[ language_user1 ] = " ";
|
||||
};
|
||||
ToolBoxItem
|
||||
{
|
||||
Type = TOOLBOXITEM_SEPARATOR ;
|
||||
};
|
||||
ToolBoxItem
|
||||
{
|
||||
Identifier = TI_DOCTEMPLATE_PRINT;
|
||||
ItemBitmap = Bitmap { File = "sc05504.bmp" ; };
|
||||
Text = "Drucken" ;
|
||||
Text [ english_us ] = "Print" ;
|
||||
Text[ language_user1 ] = " ";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
ModalDialog DLG_DOCTEMPLATE
|
||||
{
|
||||
HelpId = HID_TEMPLATEDLG_DIALOG ;
|
||||
OutputSize = TRUE ;
|
||||
SVLook = TRUE ;
|
||||
Size = MAP_APPFONT( 400, 245 );
|
||||
Text = "Vorlagen und Dokumente" ;
|
||||
Text [ english_us ] = "Templates and Documents" ;
|
||||
Closeable = TRUE ;
|
||||
Moveable = TRUE ;
|
||||
FixedLine FL_DOCTEMPLATE
|
||||
{
|
||||
Pos = MAP_APPFONT( 1, 219 );
|
||||
Size = MAP_APPFONT( 398, 1 );
|
||||
};
|
||||
PushButton BTN_DOCTEMPLATE_MANAGE
|
||||
{
|
||||
Disable = TRUE;
|
||||
Pos = MAP_APPFONT( 6, 225 );
|
||||
Size = MAP_APPFONT( 50, 14 );
|
||||
Text = "~Verwalten...";
|
||||
Text [ english_us ] = "Manage...";
|
||||
};
|
||||
PushButton BTN_DOCTEMPLATE_EDIT
|
||||
{
|
||||
Pos = MAP_APPFONT( 59, 225 );
|
||||
Size = MAP_APPFONT( 50, 14 );
|
||||
Text = "~Bearbeiten";
|
||||
Text [ english_us ] = "Edit";
|
||||
};
|
||||
OKButton BTN_DOCTEMPLATE_OPEN
|
||||
{
|
||||
Pos = MAP_APPFONT( 235, 225 );
|
||||
Size = MAP_APPFONT( 50, 14 );
|
||||
DefButton = TRUE;
|
||||
Text = "Ö~ffnen";
|
||||
Text [ english_us ] = "Open";
|
||||
};
|
||||
CancelButton BTN_DOCTEMPLATE_CANCEL
|
||||
{
|
||||
Pos = MAP_APPFONT( 288, 225 );
|
||||
Size = MAP_APPFONT( 50, 14 );
|
||||
};
|
||||
HelpButton BTN_DOCTEMPLATE_HELP
|
||||
{
|
||||
Pos = MAP_APPFONT( 344, 225 );
|
||||
Size = MAP_APPFONT( 50, 14 );
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user