diff options
author | Mathias Bauer <mba@openoffice.org> | 2010-01-06 19:26:54 +0100 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2010-01-06 19:26:54 +0100 |
commit | 20bf200105f30e4c0a271c5e4eb75b665b9a45fb (patch) | |
tree | e6406ee0b764595fd17c28d55a9609a231813ad0 /svtools/inc | |
parent | 787d9d8a72387257a758128e8899ebfa45088b00 (diff) |
#i107450#: move code from svx to new module editeng
Diffstat (limited to 'svtools/inc')
-rw-r--r-- | svtools/inc/svtools/filter.hxx | 5 | ||||
-rw-r--r-- | svtools/inc/svtools/svxbox.hxx | 196 | ||||
-rw-r--r-- | svtools/inc/svtools/unitconv.hxx | 112 |
3 files changed, 313 insertions, 0 deletions
diff --git a/svtools/inc/svtools/filter.hxx b/svtools/inc/svtools/filter.hxx index 942323ac00e1..ae9f43a37579 100644 --- a/svtools/inc/svtools/filter.hxx +++ b/svtools/inc/svtools/filter.hxx @@ -52,6 +52,7 @@ struct ImplDirEntryHelper }; class Window; +class Graphic; #define OPT_FILTERSECTION "Graphic" @@ -409,6 +410,10 @@ public: const Link GetFilterCallback() const; static GraphicFilter* GetGraphicFilter(); + static int LoadGraphic( const String& rPath, const String& rFilter, + Graphic& rGraphic, + GraphicFilter* pFilter = NULL, + USHORT* pDeterminedFormat = NULL ); }; // ------------------------------------ diff --git a/svtools/inc/svtools/svxbox.hxx b/svtools/inc/svtools/svxbox.hxx new file mode 100644 index 000000000000..53c57014c28f --- /dev/null +++ b/svtools/inc/svtools/svxbox.hxx @@ -0,0 +1,196 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: svxbox.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SVX_BOX_HXX +#define _SVX_BOX_HXX + +// include --------------------------------------------------------------- + +#include <svl/svarray.hxx> +#include <tools/string.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/combobox.hxx> +#include <svtools/svtdllapi.h> + +// forward --------------------------------------------------------------- + +class SvxBoxEntry; +class SvxListBase; + +SV_DECL_PTRARR( SvxEntryLst, SvxBoxEntry*, 10, 10 ) + +// class SvxBoxEntry ----------------------------------------------------- + +class SVT_DLLPUBLIC SvxBoxEntry +{ + friend class SvxListBox; + friend class SvxComboBox; + +public: + SvxBoxEntry( const String& aName, USHORT nId=0 ); + SvxBoxEntry( const SvxBoxEntry& rOrg ); + SvxBoxEntry(); + + String aName; + USHORT nId; + +private: + BOOL bModified; + BOOL bNew; +}; + +// class SvxListBox ------------------------------------------------------ + +class SVT_DLLPUBLIC SvxListBox : public ListBox +{ + using ListBox::InsertEntry; + using ListBox::RemoveEntry; + using ListBox::GetEntryPos; + using ListBox::IsEntrySelected; + using ListBox::SelectEntry; + +public: + SvxListBox( Window* pParent, WinBits nBits = WB_BORDER ); + SvxListBox( Window* pParent, const ResId& rId ); + ~SvxListBox(); + + void InsertNewEntry( const SvxBoxEntry& rEntry ); + void InsertEntry( const SvxBoxEntry& rEntry, + USHORT nId = LISTBOX_ENTRY_NOTFOUND ); + + void RemoveEntry( USHORT nPos ); + void RemoveEntry( const SvxBoxEntry& rEntry ); + + void Clear(); + + USHORT GetEntryPos( const SvxBoxEntry& rEntry ) const; + const SvxBoxEntry& GetSvxBoxEntry( USHORT nIdx ) const; + + inline BOOL IsEntrySelected( const SvxBoxEntry& rEntry ) const; + const SvxBoxEntry& GetSelectSvxBoxEntry( USHORT nIdx = 0 ) const; + inline void SelectEntry( const SvxBoxEntry& rEntry, + BOOL bSelect = TRUE ); + + void ModifyEntry( USHORT nPos, const String& aName ); + USHORT GetModifiedCount() const; + const SvxBoxEntry& GetModifiedEntry( USHORT nPos ) const; + + USHORT GetRemovedCount() const; + const SvxBoxEntry& GetRemovedEntry( USHORT nPos ) const; + + USHORT GetNewCount() const; + const SvxBoxEntry& GetNewEntry( USHORT nPos ) const; + +private: + SvxEntryLst aEntryLst; + SvxEntryLst aDelEntryLst; + SvxBoxEntry aDefault; + + void InitListBox(); + void InsertSorted( SvxBoxEntry* pEntry ); +}; + +// inlines --------------------------------------------------------------- + +inline BOOL SvxListBox::IsEntrySelected( const SvxBoxEntry& aEntry ) const + { return ListBox::IsEntrySelected( aEntry.aName ); } + +inline void SvxListBox::SelectEntry( const SvxBoxEntry& aEntry, BOOL bSelect ) + { ListBox::SelectEntry( aEntry.aName, bSelect ); } + +// enum SvxComboBoxStyle ------------------------------------------------- + +enum SvxComboBoxStyle +{ + SVX_CBS_UPPER = 0x01, + SVX_CBS_LOWER = 0x02, + SVX_CBS_ALL = 0x04, + SVX_CBS_FILENAME = 0x08, +#ifdef WIN + SVX_CBS_SW_FILENAME = SVX_CBS_FILENAME | SVX_CBS_LOWER +#else + SVX_CBS_SW_FILENAME = SVX_CBS_FILENAME +#endif +}; + +// class SvxComboBox ----------------------------------------------------- + +class SVT_DLLPUBLIC SvxComboBox : public ComboBox +{ + using ComboBox::InsertEntry; + using ComboBox::RemoveEntry; + using ComboBox::GetEntryPos; + using Window::SetStyle; + +public: + SvxComboBox( Window* pParent, + WinBits nBits = WB_BORDER, USHORT nStyleBits = SVX_CBS_ALL ); + SvxComboBox( Window* pParent, const ResId& rId, USHORT nStyleBits = SVX_CBS_ALL ); + ~SvxComboBox(); + + void InsertNewEntry( const SvxBoxEntry& ); + void InsertEntry( const SvxBoxEntry& ); + + void RemoveEntry( USHORT nPos ); + void RemoveEntry( const SvxBoxEntry& rEntry ); + + void Clear(); + + USHORT GetEntryPos( const SvxBoxEntry& rEntry ) const; + const SvxBoxEntry& GetEntry( USHORT nIdx ) const; + + void ModifyEntry( USHORT nPos, const String& aName ); + USHORT GetModifiedCount() const; + const SvxBoxEntry& GetModifiedEntry( USHORT nPos ) const; + + USHORT GetRemovedCount() const; + const SvxBoxEntry& GetRemovedEntry( USHORT nPos ) const; + + USHORT GetNewCount() const; + const SvxBoxEntry& GetNewEntry( USHORT nPos ) const; + + USHORT GetStyle() const { return nStyle; } + void SetStyle( const USHORT nSt ) { nStyle = nSt; } + + String GetText() const; + +private: + SvxEntryLst aEntryLst; + SvxEntryLst aDelEntryLst; + SvxBoxEntry aDefault; + USHORT nStyle; + + virtual void KeyInput( const KeyEvent& rKEvt ); + + void InitComboBox(); + void InsertSorted( SvxBoxEntry* pEntry ); +}; + +#endif + diff --git a/svtools/inc/svtools/unitconv.hxx b/svtools/inc/svtools/unitconv.hxx new file mode 100644 index 000000000000..4d7358991b45 --- /dev/null +++ b/svtools/inc/svtools/unitconv.hxx @@ -0,0 +1,112 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: dlgutil.hxx,v $ + * $Revision: 1.11 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SVX_DLGUTIL_HXX +#define _SVX_DLGUTIL_HXX + +// include --------------------------------------------------------------- +#include <vcl/field.hxx> +#include "svtools/svtdllapi.h" +#include <svl/poolitem.hxx> + +// macro ----------------------------------------------------------------- + +// typedef --------------------------------------------------------------- + +typedef long (*FUNC_CONVERT)(long); + +// Functions ------------------------------------------------------------- + +SVT_DLLPUBLIC void SetFieldUnit( MetricField& rCtrl, SfxMapUnit eUnit, BOOL bAll = FALSE ); +SVT_DLLPUBLIC void SetFieldUnit( MetricBox& rCtrl, SfxMapUnit eUnit, BOOL bAll = FALSE ); + +SVT_DLLPUBLIC long CalcToUnit( float nIn, SfxMapUnit eUnit ); +SVT_DLLPUBLIC long CalcToPoint( long nIn, SfxMapUnit eUnit, USHORT nFaktor ); + +SVT_DLLPUBLIC long ItemToControl( long nIn, SfxMapUnit eItem, SfxFieldUnit eCtrl ); +SVT_DLLPUBLIC long ControlToItem( long nIn, SfxFieldUnit eCtrl, SfxMapUnit eItem ); + +SVT_DLLPUBLIC FieldUnit MapToFieldUnit( const SfxMapUnit eUnit ); +SVT_DLLPUBLIC MapUnit FieldToMapUnit( const SfxFieldUnit eUnit ); + +SVT_DLLPUBLIC long ConvertValueToMap( long nVal, SfxMapUnit eUnit ); +SVT_DLLPUBLIC long ConvertValueToUnit( long nVal, SfxMapUnit eUnit ); + +SVT_DLLPUBLIC void SetMetricValue( MetricField& rField, long lCoreValue, SfxMapUnit eUnit ); +SVT_DLLPUBLIC long GetCoreValue( const MetricField& rField, SfxMapUnit eUnit ); + +#if 0 +// to Twips +SVT_DLLPUBLIC long CMToTwips( long nIn ); +SVT_DLLPUBLIC long MMToTwips( long nIn ); +SVT_DLLPUBLIC long InchToTwips( long nIn ); +SVT_DLLPUBLIC long PointToTwips( long nIn ); +SVT_DLLPUBLIC long PicaToTwips( long nIn ); + +// to CM +SVT_DLLPUBLIC long TwipsToCM( long nIn ); +SVT_DLLPUBLIC long InchToCM( long nIn ); +SVT_DLLPUBLIC long MMToCM( long nIn ); +SVT_DLLPUBLIC long PointToCM( long nIn ); +SVT_DLLPUBLIC long PicaToCM( long nIn ); + +// to MM +SVT_DLLPUBLIC long TwipsToMM( long nIn ); +SVT_DLLPUBLIC long CMToMM( long nIn ); +SVT_DLLPUBLIC long InchToMM( long nIn ); +SVT_DLLPUBLIC long PointToMM( long nIn ); +SVT_DLLPUBLIC long PicaToMM( long nIn ); + +// to Inch +SVT_DLLPUBLIC long TwipsToInch(long nIn ); +SVT_DLLPUBLIC long CMToInch(long nIn ); +SVT_DLLPUBLIC long MMToInch(long nIn ); +SVT_DLLPUBLIC long PointToInch(long nIn ); +SVT_DLLPUBLIC long PicaToInch(long nIn ); + +// to Point +SVT_DLLPUBLIC long TwipsToPoint(long nIn ); +SVT_DLLPUBLIC long InchToPoint(long nIn ); +SVT_DLLPUBLIC long CMToPoint(long nIn ); +SVT_DLLPUBLIC long MMToPoint(long nIn ); +SVT_DLLPUBLIC long PicaToPoint(long nIn ); + +// To Pica +long TwipsToPica(long nIn ); +long InchToPica(long nIn ); +long PointToPica(long nIn ); +long CMToPica(long nIn ); +long MMToPica(long nIn ); + +#endif + +SVT_DLLPUBLIC long TransformMetric( long nVal, FieldUnit aOld, FieldUnit aNew ); + +#endif + |