summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2009-12-02 13:40:39 +0100
committerMathias Bauer <mba@openoffice.org>2009-12-02 13:40:39 +0100
commit50ecff830f5211792dd8e8e14c1ecd1564600ecb (patch)
tree445b801d7e42ec7b520a6d8db50cc218cdc394bd
parent100882583706d346d20d36f39b534789f62df2a4 (diff)
parent0b46bdb4967eac005e006bd7cece131ca88a7ddd (diff)
merge with db33a
-rw-r--r--svl/inc/svl/solar.hrc15
-rw-r--r--svtools/inc/roadmap.hxx82
-rw-r--r--svtools/inc/svtools/hyperlabel.hxx11
-rw-r--r--svtools/source/control/hyperlabel.cxx43
-rw-r--r--svtools/source/control/roadmap.cxx687
-rw-r--r--toolkit/inc/toolkit/awt/vclxtopwindow.hxx37
-rw-r--r--toolkit/inc/toolkit/awt/vclxwindows.hxx5
-rw-r--r--toolkit/source/awt/vclxdialog.cxx1
-rw-r--r--toolkit/source/awt/vclxtopwindow.cxx166
-rw-r--r--toolkit/source/awt/vclxwindows.cxx3
-rw-r--r--toolkit/source/controls/unocontrol.cxx8
-rw-r--r--transex3/inc/export.hxx12
-rw-r--r--transex3/inc/gsicheck.hxx (renamed from transex3/source/gsicheck.hxx)0
-rw-r--r--transex3/inc/inireader.hxx52
-rw-r--r--transex3/inc/treeconfig.hxx28
-rw-r--r--transex3/source/cfgmerge.cxx4
-rw-r--r--transex3/source/export2.cxx13
-rw-r--r--transex3/source/hw2fw.cxx202
-rw-r--r--transex3/source/inireader.cxx132
-rw-r--r--transex3/source/localize.cxx183
-rw-r--r--transex3/source/makefile.mk30
-rw-r--r--transex3/source/treeconfig.cxx128
-rw-r--r--transex3/source/txtconv.cxx168
-rw-r--r--transex3/source/xrmmerge.cxx4
-rw-r--r--vcl/inc/vcl/wrkwin.hxx2
-rw-r--r--vcl/source/window/wrkwin.cxx2
26 files changed, 986 insertions, 1032 deletions
diff --git a/svl/inc/svl/solar.hrc b/svl/inc/svl/solar.hrc
index 73e17bfbc2f6..96149b89131c 100644
--- a/svl/inc/svl/solar.hrc
+++ b/svl/inc/svl/solar.hrc
@@ -132,6 +132,8 @@
#define RID_FILTER_START (RID_LIB_START+10200)
#define RID_FILTER_END (RID_LIB_START+10299)
+// do *NOT* add more ranges here, RID_LIB_END is (RID_LIB_START + 10000)
+
#define RID_APP_START 20000
#define RID_APP_END 31999
@@ -144,12 +146,6 @@
#define RID_SD_START (27000)
#define RID_SD_END (27999)
-#define RID_Sa_START (28000)
-#define RID_Sa_END (28999)
-
-#define RID_Sb_START (29000)
-#define RID_Sb_END (29999)
-
#define RID_OBJ_START (30000)
#define RID_OBJ_END (32767)
@@ -191,8 +187,7 @@
#define HID_WIZARD_END (HID_LIB_START+999)
//please note: There is also HID_WIZARD2 below
-#define HID_EXTENSIONS_START (HID_LIB_START+1000)
-#define HID_EXTENSIONS_END (HID_LIB_START+1099)
+// FREE
#define HID_CUI_START (HID_LIB_START+1100)
#define HID_CUI_END (HID_LIB_START+1699)
@@ -302,5 +297,9 @@
#define HID_FORMULA_START (HID_OBJ_START+2081)
#define HID_FORMULA_END (HID_OBJ_START+2280)
+#define HID_EXTENSIONS_START (HID_OBJ_START+2281)
+#define HID_EXTENSIONS_END (HID_OBJ_START+2800)
+
+
#endif
diff --git a/svtools/inc/roadmap.hxx b/svtools/inc/roadmap.hxx
index 8a6f75eb1428..14ed6abceed6 100644
--- a/svtools/inc/roadmap.hxx
+++ b/svtools/inc/roadmap.hxx
@@ -54,64 +54,8 @@ namespace svt
typedef sal_Int32 ItemIndex;
};
-
class RoadmapImpl;
-
-
- class ORoadmapIDHyperLabel : public FixedText
- {
- public:
- ORoadmapIDHyperLabel( Window* _pParent, const ResId& _rId );
- ORoadmapIDHyperLabel( Window* _pParent, WinBits _nWinStyle = 0 );
- ~ORoadmapIDHyperLabel( );
- virtual void DataChanged( const DataChangedEvent& rDCEvt );
- };
-
- class ORoadmapHyperLabel : public RoadmapTypes
- {
- private:
- ORoadmapIDHyperLabel* mpIDLabel;
- HyperLabel* mpDescHyperLabel;
-
-
- public:
-
- ORoadmapHyperLabel( Window* _pParent, const ResId& _rId );
- ORoadmapHyperLabel( Window* _pParent, WinBits _nWinStyle = 0 );
- ~ORoadmapHyperLabel( );
-
- void SetID( sal_Int16 _ID );
- sal_Int16 GetID() const;
-
- void SetIndex( sal_Int32 _Index );
- sal_Int32 GetIndex() const;
-
- void SetLabel( ::rtl::OUString _rText );
- ::rtl::OUString GetLabel( );
-
- void SetLabelAndSize( ItemIndex _RMIndex, ::rtl::OUString _rText, const Size& rNewSize);
-
- void SetPosition( ORoadmapHyperLabel* OldHyperLabel );
- Point GetLogicalPosition();
-
- void ToggleBackgroundColor( const Color& _rGBColor );
- void SetInteractive( sal_Bool _bInteractive );
-
- void SetClickHdl( const Link& rLink );
- const Link& GetClickHdl() const;
- void SetZOrder( ORoadmapHyperLabel* pRefRoadmapHyperLabel, USHORT nFlags );
- void Enable( BOOL bEnable = TRUE);
- BOOL IsEnabled() const;
- void GrabFocus();
-
- void SetIDLabel(ORoadmapIDHyperLabel* _pIDLabel){mpIDLabel = _pIDLabel;};
- ORoadmapIDHyperLabel* GetIDLabel() const { return mpIDLabel;};
-
- HyperLabel* GetDescriptionHyperLabel() const { return mpDescHyperLabel;};
- void SetDescriptionHyperLabel(HyperLabel* _pDescriptionHyperLabel){mpDescHyperLabel = _pDescriptionHyperLabel;};
- };
-
-
+ class RoadmapItem;
//=====================================================================
//= Roadmap
@@ -135,7 +79,7 @@ namespace svt
void EnableRoadmapItem( ItemId _nItemId, sal_Bool _bEnable, ItemIndex _nStartIndex = 0 );
sal_Bool IsRoadmapItemEnabled( ItemId _nItemId, ItemIndex _nStartIndex = 0 ) const;
- void ChangeRoadmapItemLabel( ItemId _nID, ::rtl::OUString sLabel, ItemIndex _nStartIndex = 0 );
+ void ChangeRoadmapItemLabel( ItemId _nID, const ::rtl::OUString& sLabel, ItemIndex _nStartIndex = 0 );
::rtl::OUString GetRoadmapItemLabel( ItemId _nID, ItemIndex _nStartIndex = 0 );
void ChangeRoadmapItemID( ItemId _nID, ItemId _NewID, ItemIndex _nStartIndex = 0 );
@@ -149,8 +93,8 @@ namespace svt
ItemId GetItemID( ItemIndex _nIndex ) const;
ItemIndex GetItemIndex( ItemId _nID ) const;
- void InsertRoadmapItem( ItemIndex _Index, ::rtl::OUString _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled = sal_True );
- void ReplaceRoadmapItem( ItemIndex _Index, ::rtl::OUString _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled );
+ void InsertRoadmapItem( ItemIndex _Index, const ::rtl::OUString& _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled = sal_True );
+ void ReplaceRoadmapItem( ItemIndex _Index, const ::rtl::OUString& _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled );
void DeleteRoadmapItem( ItemIndex _nIndex );
ItemId GetCurrentRoadmapItemID() const;
@@ -172,22 +116,20 @@ namespace svt
private:
DECL_LINK(ImplClickHdl, HyperLabel*);
- ORoadmapHyperLabel* GetByIndex( ItemIndex _nItemIndex );
- const ORoadmapHyperLabel* GetByIndex( ItemIndex _nItemIndex ) const;
+ RoadmapItem* GetByIndex( ItemIndex _nItemIndex );
+ const RoadmapItem* GetByIndex( ItemIndex _nItemIndex ) const;
- ORoadmapHyperLabel* GetByID( ItemId _nID, ItemIndex _nStartIndex = 0 );
- const ORoadmapHyperLabel* GetByID( ItemId _nID, ItemIndex _nStartIndex = 0 ) const;
- ORoadmapHyperLabel* GetPreviousHyperLabel( ItemIndex _Index);
+ RoadmapItem* GetByID( ItemId _nID, ItemIndex _nStartIndex = 0 );
+ const RoadmapItem* GetByID( ItemId _nID, ItemIndex _nStartIndex = 0 ) const;
+ RoadmapItem* GetPreviousHyperLabel( ItemIndex _Index);
void DrawHeadline();
void DeselectOldRoadmapItems();
ItemId GetNextAvailableItemId( ItemIndex _NewIndex );
ItemId GetPreviousAvailableItemId( ItemIndex _NewIndex );
- ORoadmapHyperLabel* GetByPointer(Window* pWindow);
- void InitializeHyperLabelSize();
- ORoadmapHyperLabel* InsertHyperLabel( ItemIndex _Index, ::rtl::OUString _aStr, ItemId _RMID, sal_Bool _bEnabled = sal_True );
- void UpdatefollowingHyperLabels( ItemIndex _Index, sal_Int16 _nadd = 1);
- void SetRoadmapLabel(ORoadmapHyperLabel* CurHyperLabel, sal_Int32 _nPrefix, String _sDescription);
+ RoadmapItem* GetByPointer(Window* pWindow);
+ RoadmapItem* InsertHyperLabel( ItemIndex _Index, const ::rtl::OUString& _aStr, ItemId _RMID, sal_Bool _bEnabled = sal_True );
+ void UpdatefollowingHyperLabels( ItemIndex _Index );
};
//.........................................................................
diff --git a/svtools/inc/svtools/hyperlabel.hxx b/svtools/inc/svtools/hyperlabel.hxx
index c11568816158..939b1799c0de 100644
--- a/svtools/inc/svtools/hyperlabel.hxx
+++ b/svtools/inc/svtools/hyperlabel.hxx
@@ -75,26 +75,25 @@ namespace svt
void SetIndex( sal_Int32 _Index );
sal_Int32 GetIndex() const;
- void SetLabelAndSize( ::rtl::OUString _rText, const Size& rNewSize);
- void SetLabel( ::rtl::OUString _rText );
+ void SetLabel( const ::rtl::OUString& _rText );
sal_Int32 GetLogicWidth();
::rtl::OUString GetLabel( );
- void SetHyperLabelPosition(sal_uInt16 XPos, sal_uInt16 YPos);
- Point GetLogicalPosition();
-
void ToggleBackgroundColor( const Color& _rGBColor );
void SetInteractive( sal_Bool _bInteractive );
void SetClickHdl( const Link& rLink ) { maClickHdl = rLink; }
const Link& GetClickHdl() const { return maClickHdl; }
+ Size CalcMinimumSize( long nMaxWidth = 0 ) const;
+
private:
DECL_LINK(ImplClickHdl, HyperLabel*);
- sal_Bool ImplCalcMinimumSize(const Size& _rCompSize );
+ private:
+ using FixedText::CalcMinimumSize;
};
}
diff --git a/svtools/source/control/hyperlabel.cxx b/svtools/source/control/hyperlabel.cxx
index ec8387ecb662..7d7477130e0d 100644
--- a/svtools/source/control/hyperlabel.cxx
+++ b/svtools/source/control/hyperlabel.cxx
@@ -107,35 +107,16 @@ namespace svt
}
- void HyperLabel::SetLabelAndSize(::rtl::OUString _rText, const Size& _rNewSize )
+ Size HyperLabel::CalcMinimumSize( long nMaxWidth ) const
{
- Size rLocSize = _rNewSize;
- Size rLogicLocSize = PixelToLogic( _rNewSize, MAP_APPFONT );
- SetLabel( _rText );
- ImplCalcMinimumSize( rLocSize );
- rLocSize.Height() = ( m_pImpl->m_aMinSize.Height());
-// else
-// rLocSize = LogicToPixel( Size( rLogicLocSize.Width(), LABELBASEMAPHEIGHT ), MAP_APPFONT );
- SetSizePixel( rLocSize );
- Show();
- }
-
- sal_Bool HyperLabel::ImplCalcMinimumSize(const Size& _rCompSize )
- {
- sal_Bool b_AdjustMinWidth = sal_False;
- m_pImpl->m_aMinSize = CalcMinimumSize( );
- if ( m_pImpl->m_aMinSize.Width() >= _rCompSize.Width() ) // the MinimumSize is used to size the FocusRectangle
- {
- m_pImpl->m_aMinSize.Width() = _rCompSize.Width(); // and for the MouseMove method
- m_pImpl->m_aMinSize = CalcMinimumSize(_rCompSize.Width() );
- b_AdjustMinWidth = sal_True;
- }
+ m_pImpl->m_aMinSize = FixedText::CalcMinimumSize( nMaxWidth );
+ // the MinimumSize is used to size the FocusRectangle
+ // and for the MouseMove method
m_pImpl->m_aMinSize.Height() += 2;
m_pImpl->m_aMinSize.Width() += 1;
- return b_AdjustMinWidth;
+ return m_pImpl->m_aMinSize;
}
-
void HyperLabel::implInit()
{
ToggleBackgroundColor( COL_TRANSPARENT );
@@ -234,17 +215,6 @@ namespace svt
m_pImpl->bInteractive = ( _bInteractive && IsEnabled() );
}
- void HyperLabel::SetHyperLabelPosition(sal_uInt16 XPos, sal_uInt16 YPos)
- {
- SetPosPixel( LogicToPixel( Point( XPos, YPos ), MAP_APPFONT ) );
- }
-
- Point HyperLabel::GetLogicalPosition()
- {
- Point aPoint = GetPosPixel( );
- return PixelToLogic( aPoint, MAP_APPFONT );
- }
-
sal_Int16 HyperLabel::GetID() const
{
return m_pImpl->ID;
@@ -270,10 +240,9 @@ namespace svt
return GetText();
}
- void HyperLabel::SetLabel( ::rtl::OUString _rText )
+ void HyperLabel::SetLabel( const ::rtl::OUString& _rText )
{
SetText(_rText);
- Show();
}
diff --git a/svtools/source/control/roadmap.cxx b/svtools/source/control/roadmap.cxx
index b0e178e631d9..693bca733813 100644
--- a/svtools/source/control/roadmap.cxx
+++ b/svtools/source/control/roadmap.cxx
@@ -49,11 +49,10 @@
#endif
#include <memory>
-#define RMENTRYPOINT_X 4
-#define RMENTRYPOINT_Y 27
-#define RMITEMDISTANCE_Y 6
+#define ROADMAP_INDENT_X 4
+#define ROADMAP_INDENT_Y 27
+#define ROADMAP_ITEM_DISTANCE_Y 6
#define RMINCOMPLETE -1
-#define NREMOVERMITEM -1
#define NADDITEM 1
#define INCOMPLETELABEL ::String::CreateFromAscii("...") // TODO: Cast to String
@@ -63,30 +62,18 @@ namespace svt
//.........................................................................
typedef std::vector< ::rtl::OUString > S_Vector;
- typedef std::vector< ORoadmapHyperLabel* > HL_Vector;
+ typedef std::vector< RoadmapItem* > HL_Vector;
//=====================================================================
- //= FontChanger
+ //= ColorChanger
//=====================================================================
-// class FontChanger
-// {
-// protected:
-// OutputDevice* m_pDev;
-//
-// public:
-// FontChanger( OutputDevice* _pDev, const Font& _rNewFont )
-// :m_pDev( _pDev )
-// {
-// m_pDev->Push( PUSH_FONT );
-// m_pDev->SetFont( _rNewFont );
-// }
-//
-// ~FontChanger()
-// {
-// m_pDev->Pop( );
-// }
-// };
-
+ class IDLabel : public FixedText
+ {
+ public:
+ IDLabel( Window* _pParent, WinBits _nWinStyle = 0 );
+ ~IDLabel( );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ };
//=====================================================================
//= ColorChanger
@@ -111,6 +98,51 @@ namespace svt
}
};
+ //=====================================================================
+ //= RoadmapItem
+ //=====================================================================
+ class RoadmapItem : public RoadmapTypes
+ {
+ private:
+ IDLabel* mpID;
+ HyperLabel* mpDescription;
+ const Size m_aItemPlayground;
+
+ public:
+ RoadmapItem( ORoadmap& _rParent, const Size& _rItemPlayground );
+ ~RoadmapItem( );
+
+ void SetID( sal_Int16 _ID );
+ sal_Int16 GetID() const;
+
+ void SetIndex( ItemIndex _Index );
+ ItemIndex GetIndex() const;
+
+ void SetLabel( const ::rtl::OUString& _rText );
+ ::rtl::OUString GetLabel( );
+
+ void Update( ItemIndex _RMIndex, const ::rtl::OUString& _rText );
+
+ void SetPosition( RoadmapItem* OldHyperLabel );
+
+ void ToggleBackgroundColor( const Color& _rGBColor );
+ void SetInteractive( sal_Bool _bInteractive );
+
+ void SetClickHdl( const Link& rLink );
+ const Link& GetClickHdl() const;
+ void SetZOrder( RoadmapItem* pRefRoadmapHyperLabel, USHORT nFlags );
+ void Enable( BOOL bEnable = TRUE);
+ BOOL IsEnabled() const;
+ void GrabFocus();
+
+ bool Contains( const Window* _pWindow ) const;
+
+ HyperLabel* GetDescriptionHyperLabel() const { return mpDescription; }
+
+ private:
+ void ImplUpdateIndex( const ItemIndex _nIndex );
+ void ImplUpdatePosSize();
+ };
//=====================================================================
//= RoadmapImpl
@@ -118,27 +150,32 @@ namespace svt
class RoadmapImpl : public RoadmapTypes
{
protected:
+ const ORoadmap& m_rAntiImpl;
Link m_aSelectHdl;
BitmapEx m_aPicture;
HL_Vector m_aRoadmapSteps;
ItemId m_iCurItemID;
sal_Bool m_bInteractive;
sal_Bool m_bComplete;
+ Size m_aItemSizePixel;
public:
- RoadmapImpl() :
- m_bInteractive( sal_True ),
- m_bComplete( sal_True ) {}
+ RoadmapImpl( const ORoadmap& _rAntiImpl )
+ :m_rAntiImpl( _rAntiImpl )
+ ,m_iCurItemID( -1 )
+ ,m_bInteractive( sal_True )
+ ,m_bComplete( sal_True )
+ {
+ }
- Size aHyperLabelPixelSize;
- ORoadmapHyperLabel* InCompleteHyperLabel;
+ RoadmapItem* InCompleteHyperLabel;
- void addHyperLabel( ORoadmapHyperLabel* _rRoadmapStep ) { m_aRoadmapSteps.push_back(_rRoadmapStep); }
+ void addHyperLabel( RoadmapItem* _rRoadmapStep ) { m_aRoadmapSteps.push_back(_rRoadmapStep); }
HL_Vector& getHyperLabels() { return m_aRoadmapSteps; }
const HL_Vector& getHyperLabels() const { return m_aRoadmapSteps; }
- void insertHyperLabel( ItemIndex _Index, ORoadmapHyperLabel* _rRoadmapStep ) { m_aRoadmapSteps.insert( m_aRoadmapSteps.begin() + _Index, _rRoadmapStep ); }
+ void insertHyperLabel( ItemIndex _Index, RoadmapItem* _rRoadmapStep ) { m_aRoadmapSteps.insert( m_aRoadmapSteps.begin() + _Index, _rRoadmapStep ); }
ItemIndex getItemCount() const { return m_aRoadmapSteps.size();}
@@ -157,6 +194,9 @@ namespace svt
void setSelectHdl( const Link& _rHdl ) { m_aSelectHdl = _rHdl; }
const Link& getSelectHdl( ) const { return m_aSelectHdl; }
+ void initItemSize();
+ const Size& getItemSize() const { return m_aItemSizePixel; }
+
void removeHyperLabel( ItemIndex _Index )
{
if ( ( _Index > -1 ) && ( _Index < getItemCount() ) )
@@ -172,8 +212,21 @@ namespace svt
//= Roadmap
//=====================================================================
//---------------------------------------------------------------------
- ORoadmap::ORoadmap( Window* _pParent, const ResId& _rId ):Control( _pParent, _rId )
- ,m_pImpl( new RoadmapImpl() )
+ void RoadmapImpl::initItemSize()
+ {
+ Size aLabelSize( m_rAntiImpl.GetOutputSizePixel() );
+ aLabelSize.Height() = m_rAntiImpl.LogicToPixel( Size( 0, LABELBASEMAPHEIGHT ), MAP_APPFONT ).Height();
+ aLabelSize.Width() -= m_rAntiImpl.LogicToPixel( Size( 2 * ROADMAP_INDENT_X, 0 ), MAP_APPFONT ).Width();
+ m_aItemSizePixel = aLabelSize;
+ }
+
+ //=====================================================================
+ //= Roadmap
+ //=====================================================================
+ //---------------------------------------------------------------------
+ ORoadmap::ORoadmap( Window* _pParent, const ResId& _rId )
+ :Control( _pParent, _rId )
+ ,m_pImpl( new RoadmapImpl( *this ) )
{
implInit();
}
@@ -181,7 +234,7 @@ namespace svt
//---------------------------------------------------------------------
ORoadmap::ORoadmap( Window* _pParent, WinBits _nWinStyle )
:Control( _pParent, _nWinStyle )
- , m_pImpl( new RoadmapImpl() )
+ ,m_pImpl( new RoadmapImpl( *this ) )
{
implInit();
@@ -216,14 +269,15 @@ namespace svt
// on this with calculating a new bold font.
// Unfortunately, the OutputDevice does not offer a notify mechanism for a changed font.
// So settings the font from outside is simply a forbidded scenario at the moment
+ EnableMapMode( sal_False );
}
//---------------------------------------------------------------------
ORoadmap::~ORoadmap( )
{
- HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels();
+ HL_Vector aItemsCopy = m_pImpl->getHyperLabels();
m_pImpl->getHyperLabels().clear();
- for ( HL_Vector::iterator i = pLocRoadmapItems.begin(); i< pLocRoadmapItems.end(); i++)
+ for ( HL_Vector::iterator i = aItemsCopy.begin(); i< aItemsCopy.end(); ++i )
{
delete *i;
}
@@ -240,54 +294,43 @@ namespace svt
}
- void ORoadmap::InitializeHyperLabelSize()
+ RoadmapItem* ORoadmap::GetPreviousHyperLabel( ItemIndex _Index)
{
- Size aSize = GetSizePixel();
- Size aLogicSize = PixelToLogic( aSize, MAP_APPFONT );
- aLogicSize.Height() = LABELBASEMAPHEIGHT;
- aLogicSize.Width() -= (2*RMENTRYPOINT_X);
- m_pImpl->aHyperLabelPixelSize = LogicToPixel( aLogicSize, MAP_APPFONT );
- EnableMapMode( sal_False );
- }
-
-
- ORoadmapHyperLabel* ORoadmap::GetPreviousHyperLabel( ItemIndex _Index)
- {
- ORoadmapHyperLabel* OldHyperLabel = NULL;
- if (_Index > 0)
- OldHyperLabel = m_pImpl->getHyperLabels().at( _Index - 1 );
- return OldHyperLabel;
+ RoadmapItem* pOldItem = NULL;
+ if ( _Index > 0 )
+ pOldItem = m_pImpl->getHyperLabels().at( _Index - 1 );
+ return pOldItem;
}
//---------------------------------------------------------------------
- ORoadmapHyperLabel* ORoadmap::InsertHyperLabel( ItemIndex _Index, ::rtl::OUString _sLabel, ItemId _RMID, sal_Bool _bEnabled)
+ RoadmapItem* ORoadmap::InsertHyperLabel( ItemIndex _Index, const ::rtl::OUString& _sLabel, ItemId _RMID, sal_Bool _bEnabled)
{
- if (m_pImpl->getItemCount() == 0 )
- InitializeHyperLabelSize();
- ORoadmapHyperLabel* CurHyperLabel;
- ORoadmapHyperLabel* OldHyperLabel = GetPreviousHyperLabel( _Index);
+ if ( m_pImpl->getItemCount() == 0 )
+ m_pImpl->initItemSize();
+
+ RoadmapItem* pItem = NULL;
+ RoadmapItem* pOldItem = GetPreviousHyperLabel( _Index );
- if (_RMID != RMINCOMPLETE )
+ pItem = new RoadmapItem( *this, m_pImpl->getItemSize() );
+ if ( _RMID != RMINCOMPLETE )
{
- CurHyperLabel = new ORoadmapHyperLabel(this, WB_WORDBREAK);
- CurHyperLabel->SetInteractive( m_pImpl->isInteractive() );
- m_pImpl->insertHyperLabel(_Index, CurHyperLabel );
+ pItem->SetInteractive( m_pImpl->isInteractive() );
+ m_pImpl->insertHyperLabel( _Index, pItem );
}
else
{
- CurHyperLabel = new ORoadmapHyperLabel(this);
- CurHyperLabel->SetInteractive( sal_False );
+ pItem->SetInteractive( sal_False );
}
- CurHyperLabel->SetPosition( OldHyperLabel );
- CurHyperLabel->SetLabelAndSize( _Index, _sLabel, m_pImpl->aHyperLabelPixelSize );
- CurHyperLabel->SetClickHdl(LINK( this, ORoadmap, ImplClickHdl ) );
- CurHyperLabel->SetID( _RMID );
- CurHyperLabel->SetIndex( _Index );
+ pItem->SetPosition( pOldItem );
+ pItem->Update( _Index, _sLabel );
+ pItem->SetClickHdl(LINK( this, ORoadmap, ImplClickHdl ) );
+ pItem->SetID( _RMID );
+ pItem->SetIndex( _Index );
if (!_bEnabled)
- CurHyperLabel->Enable( _bEnabled );
- return CurHyperLabel;
+ pItem->Enable( _bEnabled );
+ return pItem;
}
//---------------------------------------------------------------------
@@ -308,12 +351,14 @@ namespace svt
void ORoadmap::SetRoadmapInteractive( sal_Bool _bInteractive )
{
m_pImpl->setInteractive( _bInteractive );
- ORoadmapHyperLabel* CurHyperLabel;
- HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels();
- for ( HL_Vector::iterator i = pLocRoadmapItems.begin(); i< pLocRoadmapItems.end(); i++)
+
+ const HL_Vector& rItems = m_pImpl->getHyperLabels();
+ for ( HL_Vector::const_iterator i = rItems.begin();
+ i < rItems.end();
+ ++i
+ )
{
- CurHyperLabel = *i;
- CurHyperLabel->SetInteractive( _bInteractive );
+ (*i)->SetInteractive( _bInteractive );
}
}
@@ -326,76 +371,55 @@ namespace svt
//---------------------------------------------------------------------
void ORoadmap::SetRoadmapComplete( sal_Bool _bComplete )
{
- sal_Bool OldbComplete = m_pImpl->isComplete();
- m_pImpl->setComplete( _bComplete);
- if (_bComplete)
+ sal_Bool bWasComplete = m_pImpl->isComplete();
+ m_pImpl->setComplete( _bComplete );
+ if ( _bComplete )
{
if ( m_pImpl->InCompleteHyperLabel != NULL)
{
- if (m_pImpl->getItemCount() > 0)
- {
- HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels();
- pLocRoadmapItems.pop_back();
- delete m_pImpl->InCompleteHyperLabel;
- }
+ delete m_pImpl->InCompleteHyperLabel;
m_pImpl->InCompleteHyperLabel = NULL;
}
}
- else if (OldbComplete)
- m_pImpl->InCompleteHyperLabel = InsertHyperLabel( m_pImpl->getItemCount(), ::String::CreateFromAscii("..."), RMINCOMPLETE );
+ else if ( bWasComplete )
+ m_pImpl->InCompleteHyperLabel = InsertHyperLabel( m_pImpl->getItemCount(), ::String::CreateFromAscii( "..." ), RMINCOMPLETE );
}
//---------------------------------------------------------------------
- void ORoadmap::SetRoadmapLabel(ORoadmapHyperLabel* CurHyperLabel, sal_Int32 _nPrefix, String _sDescription)
+ void ORoadmap::UpdatefollowingHyperLabels( ItemIndex _nIndex )
{
- const xub_StrLen n_Pos = _sDescription.Search( String::CreateFromAscii(".") );
- if ( n_Pos != STRING_NOTFOUND )
+ const HL_Vector& rItems = m_pImpl->getHyperLabels();
+ if ( _nIndex < (ItemIndex)rItems.size() )
{
- const String sID = ::String::CreateFromInt32( _nPrefix );
- _sDescription.Replace(0 , n_Pos, sID );
- }
- CurHyperLabel->SetLabelAndSize( _nPrefix, _sDescription, m_pImpl->aHyperLabelPixelSize );
- }
-
- //---------------------------------------------------------------------
- void ORoadmap::UpdatefollowingHyperLabels( ItemIndex _Index, sal_Int16 )
- {
- if ( _Index < ( m_pImpl->getItemCount() ) )
- {
- Point aPos;
- String sLabel;
- HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels();
- ORoadmapHyperLabel* CurHyperLabel = NULL;
- ItemIndex n_CurPrefix = _Index + 1 ;
- for ( HL_Vector::iterator i = pLocRoadmapItems.begin()+ _Index; i< pLocRoadmapItems.end(); i++)
+ RoadmapItem* pItem = NULL;
+ for ( HL_Vector::const_iterator i = rItems.begin() + _nIndex;
+ i< rItems.end();
+ ++i, ++_nIndex
+ )
{
- CurHyperLabel = *i;
- aPos = CurHyperLabel->GetLogicalPosition();
- CurHyperLabel->SetIndex( n_CurPrefix - 1);
- sLabel = CurHyperLabel->GetLabel();
- SetRoadmapLabel(CurHyperLabel, n_CurPrefix, sLabel);
- ORoadmapHyperLabel* OldHyperLabel = GetPreviousHyperLabel( n_CurPrefix-1);
- CurHyperLabel->SetPosition( OldHyperLabel);
- n_CurPrefix++;
+ pItem = *i;
+
+ pItem->SetIndex( _nIndex );
+ pItem->SetPosition( GetPreviousHyperLabel( _nIndex ) );
}
}
if ( ! m_pImpl->isComplete() )
{
- ORoadmapHyperLabel* OldHyperLabel = GetPreviousHyperLabel( m_pImpl->getItemCount());
- m_pImpl->InCompleteHyperLabel->SetPosition( OldHyperLabel );
- m_pImpl->InCompleteHyperLabel->SetLabelAndSize( m_pImpl->getItemCount(), ::String::CreateFromAscii("..."), m_pImpl->aHyperLabelPixelSize );
+ RoadmapItem* pOldItem = GetPreviousHyperLabel( m_pImpl->getItemCount() );
+ m_pImpl->InCompleteHyperLabel->SetPosition( pOldItem );
+ m_pImpl->InCompleteHyperLabel->Update( m_pImpl->getItemCount(), ::String::CreateFromAscii("...") );
}
}
//---------------------------------------------------------------------
- void ORoadmap::ReplaceRoadmapItem( ItemIndex _Index, ::rtl::OUString _RoadmapItem, ItemId _RMID, sal_Bool _bEnabled )
+ void ORoadmap::ReplaceRoadmapItem( ItemIndex _Index, const ::rtl::OUString& _RoadmapItem, ItemId _RMID, sal_Bool _bEnabled )
{
- ORoadmapHyperLabel* CurHyperLabel = GetByIndex( _Index);
- if ( CurHyperLabel != NULL )
+ RoadmapItem* pItem = GetByIndex( _Index);
+ if ( pItem != NULL )
{
- CurHyperLabel->SetLabelAndSize( _Index, _RoadmapItem, m_pImpl->aHyperLabelPixelSize );
- CurHyperLabel->SetID( _RMID );
- CurHyperLabel->Enable( _bEnabled );
+ pItem->Update( _Index, _RoadmapItem );
+ pItem->SetID( _RMID );
+ pItem->Enable( _bEnabled );
}
}
@@ -408,7 +432,7 @@ namespace svt
//---------------------------------------------------------------------
RoadmapTypes::ItemId ORoadmap::GetItemID( ItemIndex _nIndex ) const
{
- const ORoadmapHyperLabel* pHyperLabel = GetByIndex( _nIndex );
+ const RoadmapItem* pHyperLabel = GetByIndex( _nIndex );
if ( pHyperLabel )
return pHyperLabel->GetID();
return -1;
@@ -417,28 +441,26 @@ namespace svt
//---------------------------------------------------------------------
RoadmapTypes::ItemIndex ORoadmap::GetItemIndex( ItemId _nID ) const
{
- ORoadmapHyperLabel* CurHyperLabel;
ItemId nLocID = 0;
- HL_Vector &LocHyperLabels = m_pImpl->getHyperLabels();
- ItemIndex nResult = 0;
- for ( HL_Vector::iterator i = LocHyperLabels.begin(); i< LocHyperLabels.end(); i++)
+ const HL_Vector& rItems = m_pImpl->getHyperLabels();
+ for ( HL_Vector::const_iterator i = rItems.begin();
+ i < rItems.end();
+ ++i
+ )
{
- CurHyperLabel = *i;
- nLocID = CurHyperLabel->GetID();
+ nLocID = (*i)->GetID();
if ( nLocID == _nID )
- return nResult;
- nResult++;
+ return ItemIndex( i - rItems.begin() );
}
return -1;
}
//---------------------------------------------------------------------
- void ORoadmap::InsertRoadmapItem( ItemIndex _Index, ::rtl::OUString _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled )
+ void ORoadmap::InsertRoadmapItem( ItemIndex _Index, const ::rtl::OUString& _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled )
{
- ORoadmapHyperLabel* CurHyperLabel;
- CurHyperLabel = InsertHyperLabel(_Index, _RoadmapItem, _nUniqueId, _bEnabled);
+ InsertHyperLabel( _Index, _RoadmapItem, _nUniqueId, _bEnabled );
// Todo: YPos is superfluous, if items are always appended
- UpdatefollowingHyperLabels( _Index + 1);
+ UpdatefollowingHyperLabels( _Index + 1 );
}
//---------------------------------------------------------------------
@@ -447,7 +469,7 @@ namespace svt
if ( m_pImpl->getItemCount() > 0 && ( _Index > -1) && ( _Index < m_pImpl->getItemCount() ) )
{
m_pImpl->removeHyperLabel( _Index );
- UpdatefollowingHyperLabels( _Index, NREMOVERMITEM);
+ UpdatefollowingHyperLabels( _Index );
}
}
@@ -460,33 +482,33 @@ namespace svt
//---------------------------------------------------------------------
sal_Bool ORoadmap::IsRoadmapItemEnabled( ItemId _nItemId, ItemIndex _nStartIndex ) const
{
- const ORoadmapHyperLabel* _pLabelItem = GetByID( _nItemId, _nStartIndex );
+ const RoadmapItem* _pLabelItem = GetByID( _nItemId, _nStartIndex );
return _pLabelItem ? _pLabelItem->IsEnabled() : sal_False;
}
//---------------------------------------------------------------------
void ORoadmap::EnableRoadmapItem( ItemId _nItemId, sal_Bool _bEnable, ItemIndex _nStartIndex )
{
- ORoadmapHyperLabel* CurHyperLabel = GetByID( _nItemId, _nStartIndex );
- if ( CurHyperLabel != NULL )
- CurHyperLabel->Enable( _bEnable );
+ RoadmapItem* pItem = GetByID( _nItemId, _nStartIndex );
+ if ( pItem != NULL )
+ pItem->Enable( _bEnable );
}
//---------------------------------------------------------------------
- void ORoadmap::ChangeRoadmapItemLabel( ItemId _nID, ::rtl::OUString _sLabel, ItemIndex _nStartIndex )
+ void ORoadmap::ChangeRoadmapItemLabel( ItemId _nID, const ::rtl::OUString& _sLabel, ItemIndex _nStartIndex )
{
- ORoadmapHyperLabel* CurHyperLabel = GetByID( _nID, _nStartIndex );
- if ( CurHyperLabel != NULL )
+ RoadmapItem* pItem = GetByID( _nID, _nStartIndex );
+ if ( pItem != NULL )
{
- CurHyperLabel->SetLabelAndSize( CurHyperLabel->GetIndex(), _sLabel, m_pImpl->aHyperLabelPixelSize );
- HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels();
- ItemIndex Index = _nStartIndex;
- for ( HL_Vector::iterator i = pLocRoadmapItems.begin()+ Index; i< pLocRoadmapItems.end(); i++)
+ pItem->Update( pItem->GetIndex(), _sLabel );
+
+ const HL_Vector& rItems = m_pImpl->getHyperLabels();
+ for ( HL_Vector::const_iterator i = rItems.begin() + _nStartIndex;
+ i < rItems.end();
+ ++i
+ )
{
- CurHyperLabel = *i;
- ORoadmapHyperLabel* OldHyperLabel = GetPreviousHyperLabel( Index );
- CurHyperLabel->SetPosition( OldHyperLabel);
- Index++;
+ (*i)->SetPosition( GetPreviousHyperLabel( i - rItems.begin() ) );
}
}
}
@@ -495,9 +517,9 @@ namespace svt
::rtl::OUString ORoadmap::GetRoadmapItemLabel( ItemId _nID, ItemIndex _nStartIndex )
{
- ORoadmapHyperLabel* CurHyperLabel = GetByID( _nID, _nStartIndex );
- if ( CurHyperLabel != NULL )
- return CurHyperLabel->GetLabel();
+ RoadmapItem* pItem = GetByID( _nID, _nStartIndex );
+ if ( pItem != NULL )
+ return pItem->GetLabel();
else
return ::rtl::OUString();
}
@@ -505,47 +527,47 @@ namespace svt
//---------------------------------------------------------------------
void ORoadmap::ChangeRoadmapItemID( ItemId _nID, ItemId _NewID, ItemIndex _nStartIndex )
{
- ORoadmapHyperLabel* CurHyperLabel = GetByID( _nID, _nStartIndex );
- if ( CurHyperLabel != NULL )
- CurHyperLabel->SetID( _NewID );
+ RoadmapItem* pItem = GetByID( _nID, _nStartIndex );
+ if ( pItem != NULL )
+ pItem->SetID( _NewID );
}
//---------------------------------------------------------------------
- ORoadmapHyperLabel* ORoadmap::GetByID( ItemId _nID, ItemIndex _nStartIndex)
+ RoadmapItem* ORoadmap::GetByID( ItemId _nID, ItemIndex _nStartIndex)
{
- ORoadmapHyperLabel* CurHyperLabel;
ItemId nLocID = 0;
- HL_Vector &LocHyperLabels = m_pImpl->getHyperLabels();
- for ( HL_Vector::iterator i = LocHyperLabels.begin()+ _nStartIndex; i< LocHyperLabels.end(); i++)
+ const HL_Vector& rItems = m_pImpl->getHyperLabels();
+ for ( HL_Vector::const_iterator i = rItems.begin() + _nStartIndex;
+ i < rItems.end();
+ ++i
+ )
{
- CurHyperLabel = *i;
- nLocID = CurHyperLabel->GetID();
+ nLocID = (*i)->GetID();
if ( nLocID == _nID )
- return CurHyperLabel;
+ return *i;
}
return NULL;
}
//---------------------------------------------------------------------
- const ORoadmapHyperLabel* ORoadmap::GetByID( ItemId _nID, ItemIndex _nStartIndex ) const
+ const RoadmapItem* ORoadmap::GetByID( ItemId _nID, ItemIndex _nStartIndex ) const
{
return const_cast< ORoadmap* >( this )->GetByID( _nID, _nStartIndex );
}
//---------------------------------------------------------------------
- ORoadmapHyperLabel* ORoadmap::GetByIndex( ItemIndex _nItemIndex)
+ RoadmapItem* ORoadmap::GetByIndex( ItemIndex _nItemIndex)
{
- HL_Vector &LocHyperLabels = m_pImpl->getHyperLabels();
- if ((_nItemIndex > -1) && (_nItemIndex < m_pImpl->getItemCount( ) ) )
+ const HL_Vector& rItems = m_pImpl->getHyperLabels();
+ if ( ( _nItemIndex > -1 ) && ( _nItemIndex < (ItemIndex)rItems.size() ) )
{
- ORoadmapHyperLabel* CurHyperLabel = LocHyperLabels.at(_nItemIndex); // Vectors are one-based
- return CurHyperLabel;
+ return rItems.at( _nItemIndex );
}
return NULL;
}
//---------------------------------------------------------------------
- const ORoadmapHyperLabel* ORoadmap::GetByIndex( ItemIndex _nItemIndex ) const
+ const RoadmapItem* ORoadmap::GetByIndex( ItemIndex _nItemIndex ) const
{
return const_cast< ORoadmap* >( this )->GetByIndex( _nItemIndex );
}
@@ -553,14 +575,14 @@ namespace svt
//---------------------------------------------------------------------
RoadmapTypes::ItemId ORoadmap::GetNextAvailableItemId( ItemIndex _nNewIndex )
{
- ORoadmapHyperLabel* CurHyperLabel;
+ RoadmapItem* pItem = NULL;
ItemIndex searchIndex = ++_nNewIndex;
while ( searchIndex < m_pImpl->getItemCount() )
{
- CurHyperLabel = GetByIndex( searchIndex );
- if ( CurHyperLabel->IsEnabled() )
- return CurHyperLabel->GetID( );
+ pItem = GetByIndex( searchIndex );
+ if ( pItem->IsEnabled() )
+ return pItem->GetID( );
++searchIndex;
}
@@ -570,13 +592,13 @@ namespace svt
//---------------------------------------------------------------------
RoadmapTypes::ItemId ORoadmap::GetPreviousAvailableItemId( ItemIndex _nNewIndex )
{
- ORoadmapHyperLabel* CurHyperLabel;
+ RoadmapItem* pItem = NULL;
ItemIndex searchIndex = --_nNewIndex;
while ( searchIndex > -1 )
{
- CurHyperLabel = GetByIndex( searchIndex );
- if ( CurHyperLabel->IsEnabled() )
- return CurHyperLabel->GetID( );
+ pItem = GetByIndex( searchIndex );
+ if ( pItem->IsEnabled() )
+ return pItem->GetID( );
searchIndex--;
}
@@ -586,12 +608,13 @@ namespace svt
//---------------------------------------------------------------------
void ORoadmap::DeselectOldRoadmapItems()
{
- HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels();
- ORoadmapHyperLabel* CurHyperLabel = NULL;
- for ( HL_Vector::iterator i = pLocRoadmapItems.begin(); i< pLocRoadmapItems.end(); i++)
+ const HL_Vector& rItems = m_pImpl->getHyperLabels();
+ for ( HL_Vector::const_iterator i = rItems.begin();
+ i < rItems.end();
+ ++i
+ )
{
- CurHyperLabel = *i;
- CurHyperLabel->ToggleBackgroundColor( COL_TRANSPARENT );
+ (*i)->ToggleBackgroundColor( COL_TRANSPARENT );
}
}
@@ -617,7 +640,7 @@ namespace svt
//---------------------------------------------------------------------
void ORoadmap::GetFocus()
{
- ORoadmapHyperLabel* pCurHyperLabel = GetByID( GetCurrentRoadmapItemID() );
+ RoadmapItem* pCurHyperLabel = GetByID( GetCurrentRoadmapItemID() );
if ( pCurHyperLabel != NULL )
pCurHyperLabel->GrabFocus();
}
@@ -626,15 +649,15 @@ namespace svt
sal_Bool ORoadmap::SelectRoadmapItemByID( ItemId _nNewID )
{
DeselectOldRoadmapItems();
- ORoadmapHyperLabel* CurHyperLabel = GetByID( _nNewID );
- if (CurHyperLabel != NULL)
+ RoadmapItem* pItem = GetByID( _nNewID );
+ if ( pItem != NULL )
{
- if (CurHyperLabel->IsEnabled())
+ if ( pItem->IsEnabled() )
{
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- CurHyperLabel->ToggleBackgroundColor( rStyleSettings.GetHighlightColor() ); //HighlightColor
+ pItem->ToggleBackgroundColor( rStyleSettings.GetHighlightColor() ); //HighlightColor
- CurHyperLabel->GrabFocus();
+ pItem->GrabFocus();
m_pImpl->setCurItemID(_nNewID);
Select();
@@ -670,7 +693,7 @@ namespace svt
//---------------------------------------------------------------------
void ORoadmap::DrawHeadline()
{
- Point aTextPos = LogicToPixel( Point( RMENTRYPOINT_X, 8 ), MAP_APPFONT );
+ Point aTextPos = LogicToPixel( Point( ROADMAP_INDENT_X, 8 ), MAP_APPFONT );
Size aOutputSize( GetOutputSizePixel() );
@@ -683,15 +706,16 @@ namespace svt
}
//---------------------------------------------------------------------
- ORoadmapHyperLabel* ORoadmap::GetByPointer(Window* pWindow)
+ RoadmapItem* ORoadmap::GetByPointer(Window* pWindow)
{
- ORoadmapHyperLabel* CurHyperLabel;
- HL_Vector &LocHyperLabels = m_pImpl->getHyperLabels();
- for ( HL_Vector::iterator i = LocHyperLabels.begin(); i< LocHyperLabels.end(); i++)
+ const HL_Vector& rItems = m_pImpl->getHyperLabels();
+ for ( HL_Vector::const_iterator i = rItems.begin();
+ i < rItems.end();
+ ++i
+ )
{
- CurHyperLabel = *i;
- if ( (CurHyperLabel->GetIDLabel() == pWindow) || (CurHyperLabel->GetDescriptionHyperLabel() == pWindow) )
- return CurHyperLabel;
+ if ( (*i)->Contains( pWindow ) )
+ return *i;
}
return NULL;
}
@@ -703,30 +727,30 @@ namespace svt
if ( _rNEvt.GetType() == EVENT_KEYINPUT )
{
Window* pWindow = _rNEvt.GetWindow();
- ORoadmapHyperLabel* CurHyperLabel = GetByPointer( pWindow );
- if ( CurHyperLabel != NULL )
+ RoadmapItem* pItem = GetByPointer( pWindow );
+ if ( pItem != NULL )
{
sal_Int16 nKeyCode = _rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
switch( nKeyCode )
{
case KEY_UP:
- { // Note: Performancewhise this is not optimal, because we search for an ID in the labels
+ { // Note: Performancewise this is not optimal, because we search for an ID in the labels
// and afterwards we search again for a label with the appropriate ID ->
// unnecessarily we search twice!!!
- ItemId nPrevItemID = GetPreviousAvailableItemId( CurHyperLabel->GetIndex() );
+ ItemId nPrevItemID = GetPreviousAvailableItemId( pItem->GetIndex() );
if ( nPrevItemID != -1 )
return SelectRoadmapItemByID( nPrevItemID );
}
break;
case KEY_DOWN:
{
- ItemId nNextItemID = GetNextAvailableItemId( CurHyperLabel->GetIndex() );
+ ItemId nNextItemID = GetNextAvailableItemId( pItem->GetIndex() );
if ( nNextItemID != -1 )
return SelectRoadmapItemByID( nNextItemID );
}
break;
case KEY_SPACE:
- return SelectRoadmapItemByID( CurHyperLabel->GetID() );
+ return SelectRoadmapItemByID( pItem->GetID() );
}
}
}
@@ -736,9 +760,12 @@ namespace svt
//---------------------------------------------------------------------
IMPL_LINK(ORoadmap, ImplClickHdl, HyperLabel*, _CurHyperLabel)
{
- return SelectRoadmapItemByID( _CurHyperLabel->GetID() );
+ return SelectRoadmapItemByID( _CurHyperLabel->GetID() );
}
+
+
+ //---------------------------------------------------------------------
void ORoadmap::DataChanged( const DataChangedEvent& rDCEvt )
{
if ((( rDCEvt.GetType() == DATACHANGED_SETTINGS ) ||
@@ -752,216 +779,228 @@ namespace svt
aFont.SetColor( aTextColor );
SetFont( aFont );
RoadmapTypes::ItemId curItemID = GetCurrentRoadmapItemID();
- ORoadmapHyperLabel* pLabelItem = GetByID( curItemID );
+ RoadmapItem* pLabelItem = GetByID( curItemID );
pLabelItem->ToggleBackgroundColor(rStyleSettings.GetHighlightColor());
Invalidate();
}
}
- ORoadmapHyperLabel::ORoadmapHyperLabel( Window* _pParent, const ResId& )
+ //---------------------------------------------------------------------
+ RoadmapItem::RoadmapItem( ORoadmap& _rParent, const Size& _rItemPlayground )
+ :m_aItemPlayground( _rItemPlayground )
{
- mpIDLabel = new ORoadmapIDHyperLabel(_pParent, WB_WORDBREAK);
- mpDescHyperLabel = new HyperLabel(_pParent, WB_NOTABSTOP | WB_WORDBREAK);
+ mpID = new IDLabel( &_rParent, WB_WORDBREAK );
+ mpID->SetTextColor( mpID->GetSettings().GetStyleSettings().GetFieldTextColor( ) );
+ mpID->Show();
+ mpDescription = new HyperLabel( &_rParent, WB_NOTABSTOP | WB_WORDBREAK );
+ mpDescription->Show();
}
-
- ORoadmapHyperLabel::ORoadmapHyperLabel( Window* _pParent, WinBits )
+ //---------------------------------------------------------------------
+ bool RoadmapItem::Contains( const Window* _pWindow ) const
{
- mpIDLabel = new ORoadmapIDHyperLabel(_pParent, WB_WORDBREAK);
- mpIDLabel->SetTextColor( mpIDLabel->GetSettings().GetStyleSettings().GetFieldTextColor( ) );
- mpDescHyperLabel = new HyperLabel(_pParent, WB_NOTABSTOP | WB_WORDBREAK);
+ return ( mpID == _pWindow ) || ( mpDescription == _pWindow );
}
//---------------------------------------------------------------------
- void ORoadmapHyperLabel::GrabFocus()
+ void RoadmapItem::GrabFocus()
{
- if ( mpDescHyperLabel )
- mpDescHyperLabel->GrabFocus();
+ if ( mpDescription )
+ mpDescription->GrabFocus();
}
-
- void ORoadmapHyperLabel::SetInteractive( sal_Bool _bInteractive )
+ //---------------------------------------------------------------------
+ void RoadmapItem::SetInteractive( sal_Bool _bInteractive )
{
- if ( mpDescHyperLabel )
- mpDescHyperLabel->SetInteractive(_bInteractive);
+ if ( mpDescription )
+ mpDescription->SetInteractive(_bInteractive);
}
- void ORoadmapHyperLabel::SetID( sal_Int16 _ID )
+ //---------------------------------------------------------------------
+ void RoadmapItem::SetID( sal_Int16 _ID )
{
- if ( mpDescHyperLabel )
- mpDescHyperLabel->SetID(_ID);
+ if ( mpDescription )
+ mpDescription->SetID(_ID);
}
- sal_Int16 ORoadmapHyperLabel::GetID() const
+ //---------------------------------------------------------------------
+ sal_Int16 RoadmapItem::GetID() const
{
- return mpDescHyperLabel ? mpDescHyperLabel->GetID() : sal_Int16(-1);
+ return mpDescription ? mpDescription->GetID() : sal_Int16(-1);
}
- void ORoadmapHyperLabel::SetIndex( sal_Int32 _Index )
+ //---------------------------------------------------------------------
+ void RoadmapItem::ImplUpdateIndex( const ItemIndex _nIndex )
{
- if ( mpDescHyperLabel )
- mpDescHyperLabel->SetIndex(_Index);
- }
+ if ( mpDescription )
+ mpDescription->SetIndex( _nIndex );
+ if ( mpID )
+ {
+ ::rtl::OUString aIDText = ::rtl::OUString::valueOf( (sal_Int32)( _nIndex + 1 ) ) + ::rtl::OUString::createFromAscii( "." );
+ mpID->SetText( aIDText );
+ }
- sal_Int32 ORoadmapHyperLabel::GetIndex() const
- {
- return mpDescHyperLabel ? mpDescHyperLabel->GetIndex() : sal_Int32(-1);
+ // update the geometry of both controls
+ ImplUpdatePosSize();
}
-
- void ORoadmapHyperLabel::SetLabel( ::rtl::OUString _rText )
+ //---------------------------------------------------------------------
+ void RoadmapItem::SetIndex( ItemIndex _Index )
{
- if ( mpDescHyperLabel )
- mpDescHyperLabel->SetText(_rText);
+ ImplUpdateIndex( _Index );
}
+ //---------------------------------------------------------------------
+ RoadmapTypes::ItemIndex RoadmapItem::GetIndex() const
+ {
+ return mpDescription ? mpDescription->GetIndex() : ItemIndex(-1);
+ }
- ::rtl::OUString ORoadmapHyperLabel::GetLabel( )
+ //---------------------------------------------------------------------
+ void RoadmapItem::SetLabel( const ::rtl::OUString& _rText )
{
- return mpDescHyperLabel ? mpDescHyperLabel->GetText() : String();
+ if ( mpDescription )
+ mpDescription->SetText(_rText);
}
+ //---------------------------------------------------------------------
+ ::rtl::OUString RoadmapItem::GetLabel( )
+ {
+ return mpDescription ? mpDescription->GetText() : String();
+ }
- void ORoadmapHyperLabel::SetPosition(ORoadmapHyperLabel* OldHyperLabel)
+ //---------------------------------------------------------------------
+ void RoadmapItem::SetPosition( RoadmapItem* _pOldItem )
{
- Point aNewLogicalPoint;
- Point aNewPoint;
- if (OldHyperLabel == NULL)
+ Point aIDPos;
+ if ( _pOldItem == NULL )
{
- aNewLogicalPoint = Point( RMENTRYPOINT_X, RMENTRYPOINT_Y);
- aNewPoint = mpIDLabel->LogicToPixel(aNewLogicalPoint, MAP_APPFONT );
+ aIDPos = mpID->LogicToPixel( Point( ROADMAP_INDENT_X, ROADMAP_INDENT_Y ), MAP_APPFONT );
}
else
{
- Size aOldSize = OldHyperLabel->GetDescriptionHyperLabel()->GetSizePixel();
- Point aOldLogicalPoint = OldHyperLabel->GetLogicalPosition();
- aNewLogicalPoint = Point(aOldLogicalPoint.X(), (aOldLogicalPoint.Y() + RMITEMDISTANCE_Y));
- aNewPoint = mpIDLabel->LogicToPixel(aNewLogicalPoint, MAP_APPFONT );
- aNewPoint = Point(aNewPoint.X(),aNewPoint.Y() + aOldSize.Height());
+ Size aOldSize = _pOldItem->GetDescriptionHyperLabel()->GetSizePixel();
+
+ aIDPos = _pOldItem->mpID->GetPosPixel();
+ aIDPos.Y() += aOldSize.Height();
+ aIDPos.Y() += mpID->GetParent()->LogicToPixel( Size( 0, ROADMAP_ITEM_DISTANCE_Y ) ).Height();
}
- mpIDLabel->SetPosPixel( aNewPoint );
- sal_Int32 xDescPos = aNewPoint.X() + mpIDLabel->GetSizePixel().Width();
- mpDescHyperLabel->SetPosPixel( Point(xDescPos, aNewPoint.Y()) );
- }
+ mpID->SetPosPixel( aIDPos );
+ sal_Int32 nDescPos = aIDPos.X() + mpID->GetSizePixel().Width();
+ mpDescription->SetPosPixel( Point( nDescPos, aIDPos.Y() ) );
+ }
- void ORoadmapHyperLabel::SetZOrder( ORoadmapHyperLabel* pRefRoadmapHyperLabel, USHORT nFlags )
+ //---------------------------------------------------------------------
+ void RoadmapItem::SetZOrder( RoadmapItem* pRefRoadmapHyperLabel, USHORT nFlags )
{
if (pRefRoadmapHyperLabel == NULL)
- mpDescHyperLabel->SetZOrder( NULL, nFlags); //WINDOW_ZORDER_FIRST );
+ mpDescription->SetZOrder( NULL, nFlags); //WINDOW_ZORDER_FIRST );
else
- mpDescHyperLabel->SetZOrder( pRefRoadmapHyperLabel->mpDescHyperLabel, nFlags); //, WINDOW_ZORDER_BEHIND );
+ mpDescription->SetZOrder( pRefRoadmapHyperLabel->mpDescription, nFlags); //, WINDOW_ZORDER_BEHIND );
}
-
- void ORoadmapHyperLabel::Enable( BOOL _bEnable)
+ //---------------------------------------------------------------------
+ void RoadmapItem::Enable( BOOL _bEnable)
{
- mpIDLabel->Enable(_bEnable);
- mpDescHyperLabel->Enable(_bEnable);
+ mpID->Enable(_bEnable);
+ mpDescription->Enable(_bEnable);
}
- BOOL ORoadmapHyperLabel::IsEnabled() const
+ //---------------------------------------------------------------------
+ BOOL RoadmapItem::IsEnabled() const
{
- return mpIDLabel->IsEnabled();
+ return mpID->IsEnabled();
}
-// void ORoadmapHyperLabel::GrabFocus()
-// {
-// mpDescHyperLabel->GrabFocus();
-//
-// }
-
- void ORoadmapHyperLabel::ToggleBackgroundColor( const Color& _rGBColor )
+ //---------------------------------------------------------------------
+ void RoadmapItem::ToggleBackgroundColor( const Color& _rGBColor )
{
if (_rGBColor == COL_TRANSPARENT)
{
- mpIDLabel->SetTextColor( mpIDLabel->GetSettings().GetStyleSettings().GetFieldTextColor( ) );
- mpIDLabel->SetControlBackground( COL_TRANSPARENT );
+ mpID->SetTextColor( mpID->GetSettings().GetStyleSettings().GetFieldTextColor( ) );
+ mpID->SetControlBackground( COL_TRANSPARENT );
}
else
{
- mpIDLabel->SetControlBackground( mpIDLabel->GetSettings().GetStyleSettings().GetHighlightColor() );
- mpIDLabel->SetTextColor( mpIDLabel->GetSettings().GetStyleSettings().GetHighlightTextColor( ) );
+ mpID->SetControlBackground( mpID->GetSettings().GetStyleSettings().GetHighlightColor() );
+ mpID->SetTextColor( mpID->GetSettings().GetStyleSettings().GetHighlightTextColor( ) );
}
- mpDescHyperLabel->ToggleBackgroundColor(_rGBColor);
+ mpDescription->ToggleBackgroundColor(_rGBColor);
}
-
- Point ORoadmapHyperLabel::GetLogicalPosition()
+ //---------------------------------------------------------------------
+ void RoadmapItem::ImplUpdatePosSize()
{
- Point aPoint = mpIDLabel->GetPosPixel( );
- Size aSize = Size(aPoint.X(), aPoint.Y());
- aSize = mpIDLabel->PixelToLogic( aSize, MAP_APPFONT );
- aPoint = Point(aSize.Width(), aSize.Height());
- return aPoint;
- }
+ // calculate widths
+ long nIDWidth = mpID->GetTextWidth( mpID->GetText() );
+ long nMaxIDWidth = mpID->GetTextWidth( ::rtl::OUString::createFromAscii( "100." ) );
+ nIDWidth = ::std::min( nIDWidth, nMaxIDWidth );
+
+ // check how many space the description would need
+ Size aDescriptionSize = mpDescription->CalcMinimumSize( m_aItemPlayground.Width() - nIDWidth );
+
+ // position and size both controls
+ Size aIDSize( nIDWidth, aDescriptionSize.Height() );
+ mpID->SetSizePixel( aIDSize );
+ Point aIDPos = mpID->GetPosPixel();
+ mpDescription->SetPosPixel( Point( aIDPos.X() + nIDWidth, aIDPos.Y() ) );
+ mpDescription->SetSizePixel( aDescriptionSize );
+ }
- void ORoadmapHyperLabel::SetLabelAndSize( ItemIndex _RMIndex, ::rtl::OUString _rText, const Size& _rNewSize)
+ //---------------------------------------------------------------------
+ void RoadmapItem::Update( ItemIndex _RMIndex, const ::rtl::OUString& _rText )
{
- Size rIDSize = _rNewSize;
- ::rtl::OUString aStr = ::rtl::OUString::valueOf( (sal_Int32)( _RMIndex + 1 ) ) + ::rtl::OUString::createFromAscii( "." );
- rIDSize.Width() = (sal_Int32) mpIDLabel->GetTextWidth( aStr );
- long nMaxWidth = mpIDLabel->GetTextWidth( ::rtl::OUString::createFromAscii("100.") );
- rIDSize.Width() = ::std::min( rIDSize.getWidth(),nMaxWidth );
- mpIDLabel->SetSizePixel(mpIDLabel->LogicToPixel( rIDSize));
- mpIDLabel->SetText( aStr);
- mpIDLabel->Show();
- Size rDescSize = _rNewSize;
- rDescSize.Width() -= rIDSize.Width();
- sal_Int32 xDescPos = mpIDLabel->GetPosPixel().X() + mpIDLabel->GetSizePixel().Width();
- sal_Int32 yDescPos = mpIDLabel->GetPosPixel().Y();
- Point aPoint = Point(xDescPos, yDescPos);
- mpDescHyperLabel->SetPosPixel( aPoint );
- mpDescHyperLabel->SetLabelAndSize(_rText, rDescSize);
- mpIDLabel->SetSizePixel( Size( mpIDLabel->GetSizePixel().Width(), mpDescHyperLabel->GetSizePixel().Height() ) );
+ // update description label
+ mpDescription->SetLabel( _rText );
+
+ // update the index in both controls, which triggers updating the geometry of both
+ ImplUpdateIndex( _RMIndex );
}
- ORoadmapHyperLabel::~ORoadmapHyperLabel( )
+ //---------------------------------------------------------------------
+ RoadmapItem::~RoadmapItem( )
{
{
- ::std::auto_ptr<Control> aTemp(mpIDLabel);
- mpIDLabel = NULL;
+ ::std::auto_ptr<Control> aTemp(mpID);
+ mpID = NULL;
}
{
- ::std::auto_ptr<Control> aTemp(mpDescHyperLabel);
- mpDescHyperLabel = NULL;
+ ::std::auto_ptr<Control> aTemp(mpDescription);
+ mpDescription = NULL;
}
}
-
- void ORoadmapHyperLabel::SetClickHdl( const Link& rLink )
- {
- if ( mpDescHyperLabel )
- mpDescHyperLabel->SetClickHdl( rLink);
- }
-
- const Link& ORoadmapHyperLabel::GetClickHdl( ) const
+ //---------------------------------------------------------------------
+ void RoadmapItem::SetClickHdl( const Link& rLink )
{
- return mpDescHyperLabel->GetClickHdl();
+ if ( mpDescription )
+ mpDescription->SetClickHdl( rLink);
}
-
- ORoadmapIDHyperLabel::ORoadmapIDHyperLabel( Window* _pParent, const ResId& _rId )
- :FixedText( _pParent, _rId )
+ //---------------------------------------------------------------------
+ const Link& RoadmapItem::GetClickHdl( ) const
{
+ return mpDescription->GetClickHdl();
}
- ORoadmapIDHyperLabel::ORoadmapIDHyperLabel( Window* _pParent, WinBits _nWinStyle )
+ //---------------------------------------------------------------------
+ IDLabel::IDLabel( Window* _pParent, WinBits _nWinStyle )
:FixedText( _pParent, _nWinStyle )
{
}
-
- ORoadmapIDHyperLabel::~ORoadmapIDHyperLabel( )
+ //---------------------------------------------------------------------
+ IDLabel::~IDLabel( )
{
}
-
- void ORoadmapIDHyperLabel::DataChanged( const DataChangedEvent& rDCEvt )
+ //---------------------------------------------------------------------
+ void IDLabel::DataChanged( const DataChangedEvent& rDCEvt )
{
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
FixedText::DataChanged( rDCEvt );
diff --git a/toolkit/inc/toolkit/awt/vclxtopwindow.hxx b/toolkit/inc/toolkit/awt/vclxtopwindow.hxx
index 7b4f1922b99e..4716120a347b 100644
--- a/toolkit/inc/toolkit/awt/vclxtopwindow.hxx
+++ b/toolkit/inc/toolkit/awt/vclxtopwindow.hxx
@@ -32,31 +32,45 @@
#define _TOOLKIT_AWT_VCLXTOPWINDOW_HXX_
#include <com/sun/star/awt/XSystemDependentWindowPeer.hpp>
-#include <com/sun/star/awt/XTopWindow.hpp>
+#include <com/sun/star/awt/XTopWindow2.hpp>
#include <com/sun/star/awt/XMenuBar.hpp>
#include <cppuhelper/weak.hxx>
#include <osl/mutex.hxx>
-#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase1.hxx>
#include <toolkit/awt/vclxcontainer.hxx>
-typedef ::cppu::ImplHelper2 < ::com::sun::star::awt::XTopWindow,
- ::com::sun::star::awt::XSystemDependentWindowPeer
- > VCLXTopWindow_XBase;
+typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XTopWindow2
+ > VCLXTopWindow_XBase;
+typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XSystemDependentWindowPeer
+ > VCLXTopWindow_SBase;
-class TOOLKIT_DLLPUBLIC VCLXTopWindow_Base: public VCLXTopWindow_XBase
+class TOOLKIT_DLLPUBLIC VCLXTopWindow_Base :public VCLXTopWindow_XBase
+ ,public VCLXTopWindow_SBase
{
+private:
+ const bool m_bWHWND;
+
protected:
::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar> mxMenuBar;
+ bool isSystemDependentWindowPeer() const { return m_bWHWND; }
+
virtual ::vos::IMutex& GetMutexImpl() = 0;
virtual Window* GetWindowImpl() = 0;
virtual ::cppu::OInterfaceContainerHelper& GetTopWindowListenersImpl() = 0;
+ VCLXTopWindow_Base( const bool _bSupportSystemWindowPeer );
+
public:
virtual ~VCLXTopWindow_Base();
+ // XInterface equivalents
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ // XTypeProvider equivalents
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+
// ::com::sun::star::awt::XSystemDependentWindowPeer
::com::sun::star::uno::Any SAL_CALL getWindowHandle( const ::com::sun::star::uno::Sequence< sal_Int8 >& ProcessId, sal_Int16 SystemType ) throw(::com::sun::star::uno::RuntimeException);
@@ -66,6 +80,14 @@ public:
void SAL_CALL toFront() throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL toBack() throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL setMenuBar( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar >& xMenu ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XTopWindow2
+ virtual ::sal_Bool SAL_CALL getIsMaximized() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setIsMaximized( ::sal_Bool _ismaximized ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getIsMinimized() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setIsMinimized( ::sal_Bool _isminimized ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getDisplay() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDisplay( ::sal_Int32 _display ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException);
};
// ----------------------------------------------------
@@ -75,9 +97,6 @@ public:
class VCLXTopWindow: public VCLXTopWindow_Base,
public VCLXContainer
{
-private:
- bool m_bWHWND;
-
protected:
virtual vos::IMutex& GetMutexImpl();
virtual Window* GetWindowImpl();
diff --git a/toolkit/inc/toolkit/awt/vclxwindows.hxx b/toolkit/inc/toolkit/awt/vclxwindows.hxx
index 3e61a9e9aa87..b6958c720f29 100644
--- a/toolkit/inc/toolkit/awt/vclxwindows.hxx
+++ b/toolkit/inc/toolkit/awt/vclxwindows.hxx
@@ -32,6 +32,7 @@
#define _TOOLKIT_AWT_VCLXWINDOWS_HXX_
#include <toolkit/dllapi.h>
+
#include <com/sun/star/beans/PropertyValues.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
@@ -88,8 +89,8 @@
#include <cppuhelper/weak.hxx>
#include <cppuhelper/implbase2.hxx>
-#include <toolkit/awt/vclxwindow.hxx>
-#include <toolkit/awt/vclxtopwindow.hxx>
+#include "toolkit/awt/vclxwindow.hxx"
+#include "toolkit/awt/vclxtopwindow.hxx"
#include <cppuhelper/implbase1.hxx>
#include <vcl/pointr.hxx>
diff --git a/toolkit/source/awt/vclxdialog.cxx b/toolkit/source/awt/vclxdialog.cxx
index 0712f8ca074c..32f2931e7438 100644
--- a/toolkit/source/awt/vclxdialog.cxx
+++ b/toolkit/source/awt/vclxdialog.cxx
@@ -66,6 +66,7 @@ DBG_NAME( VCLXDialog )
VCLXDialog::VCLXDialog()
: VCLXWindow()
+ , VCLXTopWindow_Base( true )
, VCLXDialog_Base()
, Bin()
, bRealized( false )
diff --git a/toolkit/source/awt/vclxtopwindow.cxx b/toolkit/source/awt/vclxtopwindow.cxx
index 26e457d74583..6e532c7bef3e 100644
--- a/toolkit/source/awt/vclxtopwindow.cxx
+++ b/toolkit/source/awt/vclxtopwindow.cxx
@@ -46,6 +46,7 @@
#include <vcl/syschild.hxx>
#include <vcl/sysdata.hxx>
#include <cppuhelper/typeprovider.hxx>
+#include <comphelper/sequence.hxx>
#include <toolkit/awt/vclxtopwindow.hxx>
#include <toolkit/awt/vclxmenu.hxx>
@@ -54,13 +55,44 @@
#include <vcl/wrkwin.hxx>
#include <vcl/syswin.hxx>
#include <vcl/menu.hxx>
+#include <vcl/svapp.hxx>
#include <tools/debug.hxx>
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Type;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::lang::IndexOutOfBoundsException;
+
+VCLXTopWindow_Base::VCLXTopWindow_Base( const bool _bSupportSystemWindowPeer )
+ :m_bWHWND( _bSupportSystemWindowPeer )
+{
+}
+
VCLXTopWindow_Base::~VCLXTopWindow_Base()
{
}
+Any VCLXTopWindow_Base::queryInterface( const Type & rType ) throw(RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet( VCLXTopWindow_XBase::queryInterface( rType ) );
+
+ // do not expose XSystemDependentWindowPeer if we do not have a system window handle
+ if ( !aRet.hasValue() && m_bWHWND )
+ aRet = VCLXTopWindow_SBase::queryInterface( rType );
+
+ return aRet;
+}
+
+Sequence< Type > VCLXTopWindow_Base::getTypes() throw(RuntimeException)
+{
+ Sequence< Type > aTypes( VCLXTopWindow_XBase::getTypes() );
+ if ( m_bWHWND )
+ aTypes = ::comphelper::concatSequences( aTypes, VCLXTopWindow_SBase::getTypes() );
+ return aTypes;
+}
+
::com::sun::star::uno::Any VCLXTopWindow_Base::getWindowHandle( const ::com::sun::star::uno::Sequence< sal_Int8 >& /*ProcessId*/, sal_Int16 SystemType ) throw(::com::sun::star::uno::RuntimeException)
{
::vos::OGuard aGuard( GetMutexImpl() );
@@ -157,6 +189,81 @@ void VCLXTopWindow_Base::setMenuBar( const ::com::sun::star::uno::Reference< ::c
mxMenuBar = rxMenu;
}
+//--------------------------------------------------------------------
+::sal_Bool SAL_CALL VCLXTopWindow_Base::getIsMaximized() throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutexImpl() );
+
+ const WorkWindow* pWindow = dynamic_cast< const WorkWindow* >( GetWindowImpl() );
+ if ( !pWindow )
+ return sal_False;
+
+ return pWindow->IsMaximized();
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL VCLXTopWindow_Base::setIsMaximized( ::sal_Bool _ismaximized ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutexImpl() );
+
+ WorkWindow* pWindow = dynamic_cast< WorkWindow* >( GetWindowImpl() );
+ if ( !pWindow )
+ return;
+
+ pWindow->Maximize( _ismaximized );
+}
+
+//--------------------------------------------------------------------
+::sal_Bool SAL_CALL VCLXTopWindow_Base::getIsMinimized() throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutexImpl() );
+
+ const WorkWindow* pWindow = dynamic_cast< const WorkWindow* >( GetWindowImpl() );
+ if ( !pWindow )
+ return sal_False;
+
+ return pWindow->IsMinimized();
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL VCLXTopWindow_Base::setIsMinimized( ::sal_Bool _isMinimized ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutexImpl() );
+
+ WorkWindow* pWindow = dynamic_cast< WorkWindow* >( GetWindowImpl() );
+ if ( !pWindow )
+ return;
+
+ _isMinimized ? pWindow->Minimize() : pWindow->Restore();
+}
+
+//--------------------------------------------------------------------
+::sal_Int32 SAL_CALL VCLXTopWindow_Base::getDisplay() throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutexImpl() );
+
+ const SystemWindow* pWindow = dynamic_cast< const SystemWindow* >( GetWindowImpl() );
+ if ( !pWindow )
+ return 0;
+
+ return pWindow->GetScreenNumber();
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL VCLXTopWindow_Base::setDisplay( ::sal_Int32 _display ) throw (RuntimeException, IndexOutOfBoundsException)
+{
+ ::vos::OGuard aGuard( GetMutexImpl() );
+
+ if ( ( _display < 0 ) || ( _display >= (sal_Int32)Application::GetScreenCount() ) )
+ throw IndexOutOfBoundsException();
+
+ SystemWindow* pWindow = dynamic_cast< SystemWindow* >( GetWindowImpl() );
+ if ( !pWindow )
+ return;
+
+ pWindow->SetScreenNumber( _display );
+}
+
// ----------------------------------------------------
// class VCLXTopWindow
// ----------------------------------------------------
@@ -167,7 +274,7 @@ void VCLXTopWindow::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
}
VCLXTopWindow::VCLXTopWindow(bool bWHWND)
- : m_bWHWND(bWHWND)
+ : VCLXTopWindow_Base( bWHWND )
{
}
@@ -193,24 +300,19 @@ Window* VCLXTopWindow::GetWindowImpl()
// ::com::sun::star::uno::XInterface
::com::sun::star::uno::Any VCLXTopWindow::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
{
- ::com::sun::star::uno::Any aRet;
- if(! m_bWHWND) {
- aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( ::com::sun::star::awt::XTopWindow*, this ) );
- }
- else {
- aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( ::com::sun::star::awt::XTopWindow*, this ),
- SAL_STATIC_CAST( ::com::sun::star::awt::XSystemDependentWindowPeer*, this ) );
- }
- return (aRet.hasValue() ? aRet : VCLXContainer::queryInterface( rType ));
+ ::com::sun::star::uno::Any aRet( VCLXTopWindow_Base::queryInterface( rType ) );
+
+ if ( !aRet.hasValue() )
+ aRet = VCLXContainer::queryInterface( rType );
+
+ return aRet;
}
::com::sun::star::uno::Sequence< sal_Int8 > VCLXTopWindow::getImplementationId() throw(::com::sun::star::uno::RuntimeException)
{
static ::cppu::OImplementationId* pId = NULL;
static ::cppu::OImplementationId* pIdWithHandle = NULL;
- if ( m_bWHWND )
+ if ( isSystemDependentWindowPeer() )
{
if( !pIdWithHandle )
{
@@ -242,41 +344,5 @@ Window* VCLXTopWindow::GetWindowImpl()
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > VCLXTopWindow::getTypes() throw(::com::sun::star::uno::RuntimeException)
{
- static ::cppu::OTypeCollection* pCollection = NULL;
- static ::cppu::OTypeCollection* pCollectionWithHandle = NULL;
-
- if ( m_bWHWND )
- {
- if( !pCollectionWithHandle )
- {
- ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
- if( !pCollectionWithHandle )
- {
- static ::cppu::OTypeCollection collectionWithHandle(
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider>* ) NULL ),
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindow>* ) NULL ),
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSystemDependentWindowPeer>* ) NULL ),
- VCLXContainer::getTypes() );
- pCollectionWithHandle = &collectionWithHandle;
- }
- }
-
- return (*pCollectionWithHandle).getTypes();
- }
- else
- {
- if( !pCollection )
- {
- ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
- if( !pCollection )
- {
- static ::cppu::OTypeCollection collection(
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider>* ) NULL ),
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindow>* ) NULL ),
- VCLXContainer::getTypes() );
- pCollection = &collection;
- }
- }
- return (*pCollection).getTypes();
- }
+ return ::comphelper::concatSequences( VCLXTopWindow_Base::getTypes(), VCLXContainer::getTypes() );
}
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index ff5dd437ef52..7757d170256a 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -421,9 +421,6 @@ VCLXButton::VCLXButton()
VCLXButton::~VCLXButton()
{
-#ifndef __SUNPRO_CC
- OSL_TRACE ("%s", __FUNCTION__);
-#endif
}
::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXButton::CreateAccessibleContext()
diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx
index 0775b6ee74f3..21876feb072b 100644
--- a/toolkit/source/controls/unocontrol.cxx
+++ b/toolkit/source/controls/unocontrol.cxx
@@ -1050,10 +1050,10 @@ void UnoControl::draw( sal_Int32 x, sal_Int32 y ) throw(RuntimeException)
if ( xDrawPeerView.is() )
{
- Reference< XVclWindowPeer > xWindowPeer;
- xWindowPeer.set( xDrawPeer, UNO_QUERY );
- if ( xWindowPeer.is() )
- xWindowPeer->setDesignMode( mbDesignMode );
+ Reference< XVclWindowPeer > xWindowPeer;
+ xWindowPeer.set( xDrawPeer, UNO_QUERY );
+ if ( xWindowPeer.is() )
+ xWindowPeer->setDesignMode( mbDesignMode );
xDrawPeerView->draw( x, y );
}
diff --git a/transex3/inc/export.hxx b/transex3/inc/export.hxx
index 3d7eee8e1eaf..ec5195034e91 100644
--- a/transex3/inc/export.hxx
+++ b/transex3/inc/export.hxx
@@ -51,6 +51,12 @@
#include <set> /* std::set*/
#include <vector> /* std::vector*/
#include <queue>
+#include <string>
+
+#include <unistd.h>
+#ifdef WNT
+#include <direct.h>
+#endif
#define NO_TRANSLATE_ISO "x-no-translate"
@@ -326,7 +332,6 @@ public:
static bool skipProject( ByteString sPrj ) ;
- static ByteString sIsoCode99;
static void InitLanguages( bool bMergeMode = false );
static void InitForcedLanguages( bool bMergeMode = false );
static std::vector<ByteString> GetLanguages();
@@ -349,12 +354,12 @@ public:
static bool isSourceLanguage( const ByteString &sLanguage );
static bool isAllowed( const ByteString &sLanguage );
- //static bool isMergingGermanAllowed( const ByteString& rPrj );
static bool LanguageAllowed( const ByteString &nLanguage );
static void Languages( std::vector<ByteString>::const_iterator& begin , std::vector<ByteString>::const_iterator& end );
static void getRandomName( const ByteString& sPrefix , ByteString& sRandStr , const ByteString& sPostfix );
static void getRandomName( ByteString& sRandStr );
+ static void getCurrentDir( std::string& dir );
static void replaceEncoding( ByteString& rString );
@@ -517,8 +522,6 @@ private:
public:
MergeDataFile( const ByteString &rFileName, const ByteString& rFile , BOOL bErrLog, CharSet aCharSet, bool bCaseSensitive = false );
-// MergeDataFile( const ByteString &rFileName, const ByteString& rFile , BOOL bErrLog, CharSet aCharSet
-// );
~MergeDataFile();
@@ -538,7 +541,6 @@ public:
static ByteString CreateKey( const ByteString& rTYP , const ByteString& rGID , const ByteString& rLID , const ByteString& rFilename , bool bCaseSensitive = false );
ByteString Dump();
-// void WriteErrorLog( const ByteString &rFileName );
void WriteError( const ByteString &rLine );
};
diff --git a/transex3/source/gsicheck.hxx b/transex3/inc/gsicheck.hxx
index 13debcfc7106..13debcfc7106 100644
--- a/transex3/source/gsicheck.hxx
+++ b/transex3/inc/gsicheck.hxx
diff --git a/transex3/inc/inireader.hxx b/transex3/inc/inireader.hxx
new file mode 100644
index 000000000000..0861290adf9f
--- /dev/null
+++ b/transex3/inc/inireader.hxx
@@ -0,0 +1,52 @@
+#include <string>
+#include <hash_map>
+#include <unicode/regex.h>
+
+using namespace std;
+
+namespace transex3
+{
+
+struct eqstr
+{
+ bool operator()( const string s1 , const string s2) const
+ {
+ return s1.compare( s2 ) == 0;
+ }
+};
+
+typedef std::hash_map< string , string > stringmap;
+typedef std::hash_map< string, stringmap* > INImap;
+
+class INIreader
+{
+ private:
+ UErrorCode section_status;
+ UErrorCode parameter_status;
+ RegexMatcher* section_match;
+ RegexMatcher* parameter_match;
+
+ public:
+ INIreader(): section_status ( U_ZERO_ERROR ) ,
+ parameter_status ( U_ZERO_ERROR )
+ {
+ section_match = new RegexMatcher ( "^\\s*\\[([a-zA-Z0-9]*)\\].*" , 0 , section_status );
+ parameter_match = new RegexMatcher ( "^\\s*([a-zA-Z0-9]*)\\s*=\\s*([a-zA-Z0-9 ]*).*" , 0 , parameter_status ) ;
+ }
+ ~INIreader()
+ {
+ delete section_match;
+ delete parameter_match;
+ }
+ // open "filename", fill hash_map with sections / paramaters
+ bool read( INImap& myMap , string& filename );
+
+ private:
+ bool is_section( string& line , string& section_str );
+ bool is_parameter( string& line , string& parameter_key , string& parameter_value );
+ inline void check_status( UErrorCode status );
+ inline void toStlString ( const UnicodeString& str, string& stl_str );
+ inline void trim( string& str );
+};
+
+}
diff --git a/transex3/inc/treeconfig.hxx b/transex3/inc/treeconfig.hxx
new file mode 100644
index 000000000000..96d693b0d376
--- /dev/null
+++ b/transex3/inc/treeconfig.hxx
@@ -0,0 +1,28 @@
+#include <vector>
+#include <string>
+
+#include "inireader.hxx"
+
+namespace transex3{
+
+class Treeconfig
+{
+
+ private:
+ INIreader inireader;
+ INImap map;
+ bool has_config_file;
+ void getCurrentDir( string& dir );
+ bool isConfigFilePresent();
+
+ public:
+
+ Treeconfig() : has_config_file( false ) { parseConfig(); }
+ // read the config file, returns true in case a config file had been found
+ bool parseConfig();
+ // returns a string vector containing all active repositories, returns true in case we are deep inside
+ // of a source tree. This could affect the behavour of the tool
+ bool getActiveRepositories( vector<string>& active_repos);
+};
+
+}
diff --git a/transex3/source/cfgmerge.cxx b/transex3/source/cfgmerge.cxx
index 21b4aeff185d..0607c9e9bb06 100644
--- a/transex3/source/cfgmerge.cxx
+++ b/transex3/source/cfgmerge.cxx
@@ -172,10 +172,6 @@ extern char *GetOutputFile( int argc, char* argv[])
Export::sLanguages = ByteString( argv[ i ]);
}
break;
- case STATE_ISOCODE99: {
- Export::sIsoCode99 = ByteString( argv[ i ]);
- }
- break;
}
}
}
diff --git a/transex3/source/export2.cxx b/transex3/source/export2.cxx
index 5db1067a7afb..7815e80e033f 100644
--- a/transex3/source/export2.cxx
+++ b/transex3/source/export2.cxx
@@ -42,6 +42,7 @@
#include <iomanip>
#include <tools/urlobj.hxx>
#include <time.h>
+#include <stdlib.h>
using namespace std;
//
@@ -93,7 +94,7 @@ ResData::~ResData()
/*****************************************************************************/
ByteString Export::sLanguages;
ByteString Export::sForcedLanguages;
-ByteString Export::sIsoCode99;
+//ByteString Export::sIsoCode99;
/*****************************************************************************/
void Export::DumpExportList( ByteString& sListName , ExportList& aList ){
@@ -648,6 +649,16 @@ int Export::getCurrentDirectory( rtl::OUString& base_fqurl_out, rtl::OUString& b
return osl::File::getFileURLFromSystemPath( base_out , base_fqurl_out );
}
+void Export::getCurrentDir( string& dir )
+{
+ char buffer[64000];
+ if( getcwd( buffer , sizeof( buffer ) ) == 0 ){
+ cerr << "Error: getcwd failed!\n";
+ exit( -1 );
+ }
+ dir = string( buffer );
+}
+
// Stolen from sal/osl/unx/tempfile.c
diff --git a/transex3/source/hw2fw.cxx b/transex3/source/hw2fw.cxx
deleted file mode 100644
index dd77b8d9210c..000000000000
--- a/transex3/source/hw2fw.cxx
+++ /dev/null
@@ -1,202 +0,0 @@
-/*************************************************************************
- *
- * 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: hw2fw.cxx,v $
- * $Revision: 1.4 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_transex3.hxx"
-#include <tools/string.hxx>
-
-struct hw_pair
-{
- sal_Unicode nFrom;
- sal_Unicode nTo;
-};
-
-#define MAKE_PAIR(a,b) { a, b }
-
-static struct hw_pair aHWPairs[] =
-{
- MAKE_PAIR( 0xFF65, 0x30FB ), // HALFWIDTH KATAKANA MIDDLE DOT --> KATAKANA MIDDLE DOT
- MAKE_PAIR( 0xFF66, 0x30F2 ), // HALFWIDTH KATAKANA LETTER WO --> KATAKANA LETTER WO
- MAKE_PAIR( 0xFF67, 0x30A1 ), // HALFWIDTH KATAKANA LETTER SMALL A --> KATAKANA LETTER SMALL A
- MAKE_PAIR( 0xFF68, 0x30A3 ), // HALFWIDTH KATAKANA LETTER SMALL I --> KATAKANA LETTER SMALL I
- MAKE_PAIR( 0xFF69, 0x30A5 ), // HALFWIDTH KATAKANA LETTER SMALL U --> KATAKANA LETTER SMALL U
- MAKE_PAIR( 0xFF6A, 0x30A7 ), // HALFWIDTH KATAKANA LETTER SMALL E --> KATAKANA LETTER SMALL E
- MAKE_PAIR( 0xFF6B, 0x30A9 ), // HALFWIDTH KATAKANA LETTER SMALL O --> KATAKANA LETTER SMALL O
- MAKE_PAIR( 0xFF6C, 0x30E3 ), // HALFWIDTH KATAKANA LETTER SMALL YA --> KATAKANA LETTER SMALL YA
- MAKE_PAIR( 0xFF6D, 0x30E5 ), // HALFWIDTH KATAKANA LETTER SMALL YU --> KATAKANA LETTER SMALL YU
- MAKE_PAIR( 0xFF6E, 0x30E7 ), // HALFWIDTH KATAKANA LETTER SMALL YO --> KATAKANA LETTER SMALL YO
- MAKE_PAIR( 0xFF6F, 0x30C3 ), // HALFWIDTH KATAKANA LETTER SMALL TU --> KATAKANA LETTER SMALL TU
- MAKE_PAIR( 0xFF70, 0x30FC ), // HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK --> KATAKANA-HIRAGANA PROLONGED SOUND MARK
- MAKE_PAIR( 0xFF71, 0x30A2 ), // HALFWIDTH KATAKANA LETTER A --> KATAKANA LETTER A
- MAKE_PAIR( 0xFF72, 0x30A4 ), // HALFWIDTH KATAKANA LETTER I --> KATAKANA LETTER I
- MAKE_PAIR( 0xFF73, 0x30A6 ), // HALFWIDTH KATAKANA LETTER U --> KATAKANA LETTER U
- MAKE_PAIR( 0xFF74, 0x30A8 ), // HALFWIDTH KATAKANA LETTER E --> KATAKANA LETTER E
- MAKE_PAIR( 0xFF75, 0x30AA ), // HALFWIDTH KATAKANA LETTER O --> KATAKANA LETTER O
- MAKE_PAIR( 0xFF76, 0x30AB ), // HALFWIDTH KATAKANA LETTER KA --> KATAKANA LETTER KA
- MAKE_PAIR( 0xFF77, 0x30AD ), // HALFWIDTH KATAKANA LETTER KI --> KATAKANA LETTER KI
- MAKE_PAIR( 0xFF78, 0x30AF ), // HALFWIDTH KATAKANA LETTER KU --> KATAKANA LETTER KU
- MAKE_PAIR( 0xFF79, 0x30B1 ), // HALFWIDTH KATAKANA LETTER KE --> KATAKANA LETTER KE
- MAKE_PAIR( 0xFF7A, 0x30B3 ), // HALFWIDTH KATAKANA LETTER KO --> KATAKANA LETTER KO
- MAKE_PAIR( 0xFF7B, 0x30B5 ), // HALFWIDTH KATAKANA LETTER SA --> KATAKANA LETTER SA
- MAKE_PAIR( 0xFF7C, 0x30B7 ), // HALFWIDTH KATAKANA LETTER SI --> KATAKANA LETTER SI
- MAKE_PAIR( 0xFF7D, 0x30B9 ), // HALFWIDTH KATAKANA LETTER SU --> KATAKANA LETTER SU
- MAKE_PAIR( 0xFF7E, 0x30BB ), // HALFWIDTH KATAKANA LETTER SE --> KATAKANA LETTER SE
- MAKE_PAIR( 0xFF7F, 0x30BD ), // HALFWIDTH KATAKANA LETTER SO --> KATAKANA LETTER SO
- MAKE_PAIR( 0xFF80, 0x30BF ), // HALFWIDTH KATAKANA LETTER TA --> KATAKANA LETTER TA
- MAKE_PAIR( 0xFF81, 0x30C1 ), // HALFWIDTH KATAKANA LETTER TI --> KATAKANA LETTER TI
- MAKE_PAIR( 0xFF82, 0x30C4 ), // HALFWIDTH KATAKANA LETTER TU --> KATAKANA LETTER TU
- MAKE_PAIR( 0xFF83, 0x30C6 ), // HALFWIDTH KATAKANA LETTER TE --> KATAKANA LETTER TE
- MAKE_PAIR( 0xFF84, 0x30C8 ), // HALFWIDTH KATAKANA LETTER TO --> KATAKANA LETTER TO
- MAKE_PAIR( 0xFF85, 0x30CA ), // HALFWIDTH KATAKANA LETTER NA --> KATAKANA LETTER NA
- MAKE_PAIR( 0xFF86, 0x30CB ), // HALFWIDTH KATAKANA LETTER NI --> KATAKANA LETTER NI
- MAKE_PAIR( 0xFF87, 0x30CC ), // HALFWIDTH KATAKANA LETTER NU --> KATAKANA LETTER NU
- MAKE_PAIR( 0xFF88, 0x30CD ), // HALFWIDTH KATAKANA LETTER NE --> KATAKANA LETTER NE
- MAKE_PAIR( 0xFF89, 0x30CE ), // HALFWIDTH KATAKANA LETTER NO --> KATAKANA LETTER NO
- MAKE_PAIR( 0xFF8A, 0x30CF ), // HALFWIDTH KATAKANA LETTER HA --> KATAKANA LETTER HA
- MAKE_PAIR( 0xFF8B, 0x30D2 ), // HALFWIDTH KATAKANA LETTER HI --> KATAKANA LETTER HI
- MAKE_PAIR( 0xFF8C, 0x30D5 ), // HALFWIDTH KATAKANA LETTER HU --> KATAKANA LETTER HU
- MAKE_PAIR( 0xFF8D, 0x30D8 ), // HALFWIDTH KATAKANA LETTER HE --> KATAKANA LETTER HE
- MAKE_PAIR( 0xFF8E, 0x30DB ), // HALFWIDTH KATAKANA LETTER HO --> KATAKANA LETTER HO
- MAKE_PAIR( 0xFF8F, 0x30DE ), // HALFWIDTH KATAKANA LETTER MA --> KATAKANA LETTER MA
- MAKE_PAIR( 0xFF90, 0x30DF ), // HALFWIDTH KATAKANA LETTER MI --> KATAKANA LETTER MI
- MAKE_PAIR( 0xFF91, 0x30E0 ), // HALFWIDTH KATAKANA LETTER MU --> KATAKANA LETTER MU
- MAKE_PAIR( 0xFF92, 0x30E1 ), // HALFWIDTH KATAKANA LETTER ME --> KATAKANA LETTER ME
- MAKE_PAIR( 0xFF93, 0x30E2 ), // HALFWIDTH KATAKANA LETTER MO --> KATAKANA LETTER MO
- MAKE_PAIR( 0xFF94, 0x30E4 ), // HALFWIDTH KATAKANA LETTER YA --> KATAKANA LETTER YA
- MAKE_PAIR( 0xFF95, 0x30E6 ), // HALFWIDTH KATAKANA LETTER YU --> KATAKANA LETTER YU
- MAKE_PAIR( 0xFF96, 0x30E8 ), // HALFWIDTH KATAKANA LETTER YO --> KATAKANA LETTER YO
- MAKE_PAIR( 0xFF97, 0x30E9 ), // HALFWIDTH KATAKANA LETTER RA --> KATAKANA LETTER RA
- MAKE_PAIR( 0xFF98, 0x30EA ), // HALFWIDTH KATAKANA LETTER RI --> KATAKANA LETTER RI
- MAKE_PAIR( 0xFF99, 0x30EB ), // HALFWIDTH KATAKANA LETTER RU --> KATAKANA LETTER RU
- MAKE_PAIR( 0xFF9A, 0x30EC ), // HALFWIDTH KATAKANA LETTER RE --> KATAKANA LETTER RE
- MAKE_PAIR( 0xFF9B, 0x30ED ), // HALFWIDTH KATAKANA LETTER RO --> KATAKANA LETTER RO
- MAKE_PAIR( 0xFF9C, 0x30EF ), // HALFWIDTH KATAKANA LETTER WA --> KATAKANA LETTER WA
- MAKE_PAIR( 0xFF9D, 0x30F3 ), // HALFWIDTH KATAKANA LETTER N --> KATAKANA LETTER N
- MAKE_PAIR( 0xFF9E, 0x3099 ), // HALFWIDTH KATAKANA VOICED SOUND MARK --> COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK
- MAKE_PAIR( 0xFF9F, 0x309A ) // HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK --> COMBINING KATAKANA-
-};
-
-
-static struct hw_pair aCombine3099[] =
-{
- { 0x30a6, 0x30f4 },
- { 0x30ab, 0x30ac },
- { 0x30ad, 0x30ae },
- { 0x30af, 0x30b0 },
- { 0x30b1, 0x30b2 },
- { 0x30b3, 0x30b4 },
- { 0x30b5, 0x30b6 },
- { 0x30b7, 0x30b8 },
- { 0x30b9, 0x30ba },
- { 0x30bb, 0x30bc },
- { 0x30bd, 0x30be },
- { 0x30bf, 0x30c0 },
- { 0x30c1, 0x30c2 },
- { 0x30c4, 0x30c5 },
- { 0x30c6, 0x30c7 },
- { 0x30c8, 0x30c9 },
- { 0x30cf, 0x30d0 },
- { 0x30d2, 0x30d3 },
- { 0x30d5, 0x30d6 },
- { 0x30d8, 0x30d9 },
- { 0x30db, 0x30dc },
- { 0x30ef, 0x30f7 },
- { 0x30f0, 0x30f8 },
- { 0x30f1, 0x30f9 },
- { 0x30f2, 0x30fa },
- { 0x30fd, 0x30fe }
-};
-
-static struct hw_pair aCombine309A[] =
-{
- { 0x30cf, 0x30d1 },
- { 0x30d2, 0x30d4 },
- { 0x30d5, 0x30d7 },
- { 0x30d8, 0x30da },
- { 0x30db, 0x30dd }
-};
-
-USHORT ImplReplaceFullWidth( sal_Unicode* pString, USHORT nLen )
-{
- sal_Unicode* pRead = pString;
- sal_Unicode* pWrite = pRead;
- USHORT nNewLen = nLen;
-
- while( (pRead - pString) < nLen )
- {
- if( pWrite != pRead )
- *pWrite = *pRead;
-
- if( *pRead >= 0xff65 && *pRead <= 0xff9f )
- {
- *pWrite = aHWPairs[ *pRead - 0xff65 ].nTo;
-
- struct hw_pair* pTable = NULL;
- int nTableEntries = 0;
- if( *pWrite == 0x3099 )
- {
- // replace 0x3099 combinations
- pTable = aCombine3099;
- nTableEntries = sizeof(aCombine3099)/sizeof(aCombine3099[0]);
- }
- else if( *pWrite == 0x309a )
- {
- // replace 0x309a combinations
- pTable = aCombine309A;
- nTableEntries = sizeof(aCombine309A)/sizeof(aCombine309A[0]);
- }
- if( pTable )
- {
- sal_Unicode c = pWrite[-1];
- for( int i = 0; i < nTableEntries; i++ )
- if( c == pTable[i].nFrom )
- {
- pWrite--;
- *pWrite = pTable[i].nTo;
- nNewLen--;
- break;
- }
- }
- }
- pRead++;
- pWrite++;
- }
- if( pWrite < pRead )
- *pWrite = 0;
-
- return nNewLen;
-}
-
-void ConvertHalfwitdhToFullwidth( String& rString )
-{
- USHORT nNewLen = ImplReplaceFullWidth( rString.GetBufferAccess(), rString.Len() );
- rString.ReleaseBufferAccess( nNewLen );
-}
diff --git a/transex3/source/inireader.cxx b/transex3/source/inireader.cxx
new file mode 100644
index 000000000000..0985e788452d
--- /dev/null
+++ b/transex3/source/inireader.cxx
@@ -0,0 +1,132 @@
+#include <unicode/regex.h>
+#include <unicode/unistr.h>
+#include <string>
+#include <fstream>
+#include <iostream>
+#include "inireader.hxx"
+
+using namespace std;
+namespace transex3
+{
+
+bool INIreader::read( INImap& myMap , string& filename )
+{
+ ifstream aFStream( filename.c_str() );
+ if( aFStream && aFStream.is_open())
+ {
+ string line;
+ string section;
+ string param_key;
+ string param_value;
+ stringmap* myvalues = 0;
+
+ while( std::getline( aFStream , line ) )
+ {
+ trim( line );
+ if( line.empty() ){
+ }
+ else if( is_section( line , section ) )
+ {
+ //cerr << "[" << section << "]\n";
+ myvalues = new stringmap();
+ myMap[ section ] = myvalues ;
+ }
+ else if ( is_parameter( line , param_key , param_value ) )
+ {
+ //cerr << "" << param_key << " = " << param_value << "\n";
+ if( myvalues )
+ {
+ (*myvalues)[ param_key ] = param_value ;
+ }
+ else
+ {
+ cerr << "ERROR: The INI file " << filename << " appears to be broken ... parameters without a section?!?\n";
+ if( aFStream.is_open() ) aFStream.close();
+ return false;
+ }
+ }
+ }
+
+ if( aFStream.is_open() )
+ aFStream.close();
+
+ return true;
+ }
+ else
+ {
+ cerr << "ERROR: Can't open file '" << filename << "'\n";
+ }
+ return false;
+}
+
+bool INIreader::is_section( string& line , string& section_str )
+{
+ // Error in regex ?
+ check_status( section_status );
+ UnicodeString target( line.c_str() , line.length() );
+
+ section_match->reset( target );
+ check_status( section_status );
+
+ if( section_match->find() )
+ {
+ check_status( section_status );
+ UnicodeString result( section_match->group( 1 , section_status) );
+ check_status( section_status );
+ toStlString( result , section_str );
+
+ return true;
+ }
+ return false;
+}
+
+bool INIreader::is_parameter( string& line , string& parameter_key , string& parameter_value )
+{
+ // Error in regex ?
+ check_status( parameter_status );
+ UnicodeString target( line.c_str() , line.length() );
+
+ parameter_match->reset( target );
+ check_status( parameter_status );
+
+ if( parameter_match->find() )
+ {
+ check_status( parameter_status );
+
+ UnicodeString result1( parameter_match->group( 1 , parameter_status) );
+ check_status( parameter_status );
+ toStlString( result1 , parameter_key );
+ UnicodeString result2( parameter_match->group( 2 , parameter_status) );
+ check_status( parameter_status );
+ toStlString( result2 , parameter_value );
+
+ return true;
+ }
+ return false;
+}
+
+void INIreader::check_status( UErrorCode status )
+{
+ if( U_FAILURE( status) )
+ {
+ cerr << "Error in or while using regex: " << u_errorName( status ) << "\n";
+ exit(-1);
+ }
+}
+
+void INIreader::toStlString( const UnicodeString& str , string& stl_str)
+{
+ // convert to string
+ char* buffer = new char[ str.length()*3 ];
+ str.extract( 0 , str.length() , buffer );
+ stl_str = string( buffer );
+ delete buffer;
+}
+
+void INIreader::trim( string& str )
+{
+ string str1 = str.substr( 0 , str.find_last_not_of(' ') + 1 );
+ str = str1.empty() ? str1 : str1.substr( str1.find_first_not_of(' ') );
+}
+
+}
diff --git a/transex3/source/localize.cxx b/transex3/source/localize.cxx
index 31143ab50d38..c82d152cac7e 100644
--- a/transex3/source/localize.cxx
+++ b/transex3/source/localize.cxx
@@ -33,7 +33,11 @@
#include "srciter.hxx"
#include "export.hxx"
+#include "treeconfig.hxx"
+#include <string>
+#include <vector>
#include <stdio.h>
+#include <iostream>
#include "tools/errcode.hxx"
#include "tools/fsys.hxx"
@@ -42,6 +46,8 @@
#include <transex3/file.hxx>
#endif
+namespace transex3
+{
//
// SourceTreeLocalizer
@@ -131,7 +137,6 @@ private:
ByteString sLanguageRestriction;
- ByteString sIsoCode99;
ByteString sOutputFile;
bool bQuiet2;
@@ -147,8 +152,7 @@ private:
void WorkOnFile(
const ByteString &rFileName,
const ByteString &rExecutable,
- const ByteString &rParameter,
- const ByteString &rIso
+ const ByteString &rParameter
);
void WorkOnFileType(
@@ -156,8 +160,7 @@ private:
const ByteString &rExtension,
const ByteString &rExecutable,
const ByteString &rParameter,
- const ByteString &rCollectMode,
- const ByteString &rIso
+ const ByteString &rCollectMode
);
void WorkOnDirectory( const ByteString &rDirectory );
BOOL ExecuteMerge();
@@ -175,8 +178,6 @@ public:
void SetLanguageRestriction( const ByteString& rRestrictions )
{ sLanguageRestriction = rRestrictions; }
- void SetIsoCode99( const ByteString& rIsoCode )
- { sIsoCode99 = rIsoCode; }
int getFileCnt();
BOOL Extract( const ByteString &rDestinationFile );
BOOL Merge( const ByteString &rSourceFile , const ByteString &rOutput );
@@ -215,16 +216,6 @@ const ByteString SourceTreeLocalizer::GetProjectName( BOOL bAbs )
DirEntry aTest = aCur + DirEntry(PRJ_DIR_NAME) + DirEntry(DLIST_NAME);
if ( aTest.Exists() )
{
- // HACK !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- if (( ByteString( aCur.GetName(), RTL_TEXTENCODING_ASCII_US ).Equals("webinstall") ) ||
- ( ByteString( aCur.GetName(), RTL_TEXTENCODING_ASCII_US ).Equals("portal") ) ||
- ( ByteString( aCur.GetName(), RTL_TEXTENCODING_ASCII_US ).Equals("xulclient") ) ||
- ( ByteString( aCur.GetName(), RTL_TEXTENCODING_ASCII_US ).Search( "wdk_" ) == 0 ))
- return "";
- // end HACK !!!!!!!!!!!!!!!!!!!!!!!!!
-
-
-
if ( bAbs )
return ByteString( aCur.GetFull(), RTL_TEXTENCODING_ASCII_US );
else
@@ -280,10 +271,9 @@ bool skipProject( ByteString sPrj )
/*****************************************************************************/
void SourceTreeLocalizer::WorkOnFile(
const ByteString &rFileName, const ByteString &rExecutable,
- const ByteString &rParameter, const ByteString &rIso )
+ const ByteString &rParameter )
/*****************************************************************************/
{
- (void) rIso; // Remove me ;)
String sFull( rFileName, RTL_TEXTENCODING_ASCII_US );
DirEntry aEntry( sFull );
ByteString sFileName( aEntry.GetName(), RTL_TEXTENCODING_ASCII_US );
@@ -294,14 +284,10 @@ void SourceTreeLocalizer::WorkOnFile(
aPath.SetCWD();
ByteString sPrj( GetProjectName());
- //printf ("prj = %s , exe = %s\n", sPrj.GetBuffer() , rExecutable.GetBuffer() );
-// printf("Skip %s = %d \n",sPrj.GetBuffer() , skipProject( sPrj ) );
- //printf("prj = %s\n",sPrj.GetBuffer());
if ( sPrj.Len() && !skipProject( sPrj ) )
{
ByteString sRoot( GetProjectRootRel());
- // get temp file
DirEntry aTemp( Export::GetTempFile());
ByteString sTempFile( aTemp.GetFull(), RTL_TEXTENCODING_ASCII_US );
@@ -442,7 +428,7 @@ BOOL SourceTreeLocalizer::CheckPositiveList( const ByteString &rFileName )
void SourceTreeLocalizer::WorkOnFileType(
const ByteString &rDirectory, const ByteString &rExtension,
const ByteString &rExecutable, const ByteString &rParameter,
- const ByteString &rCollectMode, const ByteString &rIso
+ const ByteString &rCollectMode
)
/*****************************************************************************/
{
@@ -466,7 +452,7 @@ void SourceTreeLocalizer::WorkOnFileType(
bAllowed = CheckPositiveList( sFile );
if ( bAllowed )
- WorkOnFile( sFile, rExecutable, rParameter, rIso );
+ WorkOnFile( sFile, rExecutable, rParameter );
}
}
@@ -480,7 +466,6 @@ void SourceTreeLocalizer::WorkOnDirectory( const ByteString &rDirectory )
ByteString sExecutable( ExeTable[ nIndex ][ 1 ] );
ByteString sParameter( ExeTable[ nIndex ][ 2 ] );
ByteString sCollectMode( ExeTable[ nIndex ][ 3 ] );
- ByteString sIso( ExeTable[ nIndex ][ 4 ] );
while( !sExtension.Equals( "NULL" )) {
WorkOnFileType(
@@ -488,8 +473,7 @@ void SourceTreeLocalizer::WorkOnDirectory( const ByteString &rDirectory )
sExtension,
sExecutable,
sParameter,
- sCollectMode,
- sIso
+ sCollectMode
);
nIndex++;
@@ -498,7 +482,6 @@ void SourceTreeLocalizer::WorkOnDirectory( const ByteString &rDirectory )
sExecutable = ExeTable[ nIndex ][ 1 ];
sParameter = ExeTable[ nIndex ][ 2 ];
sCollectMode = ExeTable[ nIndex ][ 3 ];
- sIso = ExeTable[ nIndex ][ 4 ];
}
}
@@ -517,12 +500,13 @@ BOOL SourceTreeLocalizer::Extract( const ByteString &rDestinationFile )
/*****************************************************************************/
{
nMode = LOCALIZE_EXTRACT;
- aSDF.Open( String( rDestinationFile, RTL_TEXTENCODING_ASCII_US ),
- STREAM_STD_WRITE | STREAM_TRUNC );
+
+ aSDF.Open( String( rDestinationFile , RTL_TEXTENCODING_ASCII_US ) , STREAM_STD_WRITE );
aSDF.SetLineDelimiter( LINEEND_CRLF );
BOOL bReturn = aSDF.IsOpen();
if ( bReturn ) {
+ aSDF.Seek( STREAM_SEEK_TO_END );
bReturn = StartExecute();
aSDF.Close();
}
@@ -530,6 +514,7 @@ BOOL SourceTreeLocalizer::Extract( const ByteString &rDestinationFile )
printf("ERROR: Can't create file %s\n", rDestinationFile.GetBuffer() );
}
nMode = LOCALIZE_NONE;
+ aSDF.Close();
return bReturn;
}
@@ -569,8 +554,6 @@ BOOL SourceTreeLocalizer::MergeSingleFile(
while( !sCandidate.Equals ("NULL") && !sCandidate.Equals(sExtension) )
sCandidate = ExeTable[ ++nIndex ][ 0 ];
- ByteString sIso( ExeTable[ nIndex ][ 4 ] );
-
if ( !sCandidate.Equals( "NULL" ) ) {
if( !aEntry.Exists()) {
DirEntryKind theDir=FSYS_KIND_FILE;
@@ -606,10 +589,6 @@ BOOL SourceTreeLocalizer::MergeSingleFile(
sCommand += sOutput;
sCommand += " ";
sCommand += ByteString( ExeTable[ nIndex ][ 2 ] );
- if ( sIso.Equals( "iso" ) && sIsoCode99.Len()) {
- sCommand += " -ISO99 ";
- sCommand += sIsoCode99;
- }
if ( sLanguageRestriction.Len()) {
sCommand += " -l ";
sCommand += sLanguageRestriction;
@@ -707,7 +686,6 @@ BOOL SourceTreeLocalizer::ExecuteMerge( )
ByteString sBDel( sDel.GetBuffer() , sDel.Len() , RTL_TEXTENCODING_UTF8 );
if( bLocal ){
xub_StrLen nPos = sOutputFileName.SearchBackward( sBDel.GetChar(0) );
- //if( nPos >= 0 )
sOutputFileName = sOutputFileName.Copy( nPos+1 , sOutputFileName.Len()-nPos-1 );
}
ByteStringBoolHashMap aFileHM;
@@ -720,7 +698,6 @@ BOOL SourceTreeLocalizer::ExecuteMerge( )
aFileHM[sFileName]=true;
}
- // RECODE THIS !!!!!!!!!!!!!!!!!!!!!
for( ByteStringBoolHashMap::iterator iter = aFileHM.begin(); iter != aFileHM.end(); ++iter ){
sFileKey = iter->first;
aSDF.Seek( 0 );
@@ -757,7 +734,6 @@ BOOL SourceTreeLocalizer::ExecuteMerge( )
bMerged = true;
if ( !MergeSingleFile( sPrj, sFile, sSDFFile ))
bReturn = FALSE;
- //}
}else{
bMerged = true;
//printf("MergeSingleFile('%s','%s','%s')\n",sPrj.GetBuffer(),sFile.GetBuffer(),sSDFFile.GetBuffer());
@@ -766,7 +742,6 @@ BOOL SourceTreeLocalizer::ExecuteMerge( )
}
}
}
- //}
aEntry.Kill();
// If Outputfile not included in the SDF file copy it without merge
@@ -793,13 +768,15 @@ BOOL SourceTreeLocalizer::Merge( const ByteString &rSourceFile , const ByteStrin
BOOL bReturn = aSDF.IsOpen();
if ( bReturn ) {
bReturn = ExecuteMerge();
- aSDF.Close();
+// aSDF.Close();
}
-
+ aSDF.Close();
nMode = LOCALIZE_NONE;
return bReturn;
}
+}
+using namespace transex3;
#define STATE_NONE 0x0000
#define STATE_EXPORT 0x0001
@@ -819,13 +796,11 @@ void Help()
fprintf( stdout,
"As part of the L10N framework, localize extracts and merges translations\n"
"out of and into the whole source tree.\n\n"
- "Syntax: localize -e|-m -l l1[=f1][,l2[=f2]][...] -f FileName [-QQ][-skip_links]\n"
+ "Syntax: localize -e -l en-US -f FileName [-QQ]\n"
"Parameter:\n"
"\t-e: Extract mode\n"
- "\t-m: Merge mode\n"
"\tFileName: Output file when extract mode, input file when merge mode\n"
"\tl1...ln: supported languages (\"all\" for all languages).\n"
- "\tf1...fn: fallback languages for supported languages\n"
"\tQQ: quiet output)"
);
@@ -834,16 +809,9 @@ void Help()
fprintf( stdout,
"\nExample 1:\n"
"==========\n"
- "localize -e -l en-US,de -f MyFile\n\n"
+ "localize -e -l en-US -f MyFile\n\n"
"All strings will be extracted for language de and language en-US.\n"
);
- fprintf( stdout,
- "\nExample 2:\n"
- "==========\n"
- "localize -m -l es -f MyFile\n\n"
- "All strings in MyFile will be merged into language es in the\n"
- "source code.\n"
- );
}
/*****************************************************************************/
@@ -880,11 +848,13 @@ int _cdecl main( int argc, char *argv[] )
bool bQuiet2 = false;
bool bSkipLinks = false;
- ByteString sIsoCode;
ByteString sLanguages;
ByteString sFileName;
ByteString sOutput;
+ bQuiet2 = true;
+ bExport = TRUE;
+
for( int i = 1; i < argc; i++ ) {
ByteString sSwitch( argv[ i ] );
sSwitch.ToUpperAscii();
@@ -895,12 +865,6 @@ int _cdecl main( int argc, char *argv[] )
return Error();
bExport = TRUE;
}
- else if ( sSwitch.Equals( "-M" )) {
- nState = STATE_MERGE;
- if ( bExport )
- return Error();
- bMerge = TRUE;
- }
else if( sSwitch.Equals( "-Q" )) {
bQuiet = true;
}
@@ -912,20 +876,12 @@ int _cdecl main( int argc, char *argv[] )
nState = STATE_FILENAME;
else if ( sSwitch.Equals( "-QQ" ))
bQuiet2 = true;
- // else if ( ByteString( argv[ i ]).ToUpperAscii().Equals( "-SKIP_LINKS" ))
- // bSkipLinks = true;
else if ( ByteString( argv[ i ]).ToUpperAscii().Equals( "-O" ) )
nState = STATE_OUTPUT;
else {
switch ( nState ) {
case STATE_NONE:
return Error();
- case STATE_ISOCODE:
- if ( sIsoCode.Len())
- return Error();
- sIsoCode = ByteString( argv[ i ] );
- nState = STATE_NONE;
- break;
case STATE_OUTPUT:
if ( sOutput.Len())
return Error();
@@ -954,12 +910,10 @@ int _cdecl main( int argc, char *argv[] )
return 1;
}
- ByteString sRoot( Export::GetEnv( "SRC_ROOT" ));
- DirEntry aRoot( String( sRoot, RTL_TEXTENCODING_ASCII_US ));
- sRoot = ByteString( aRoot.GetFull(), RTL_TEXTENCODING_ASCII_US );
+ ByteString sSolarVer( Export::GetEnv( "WORK_STAMP" ));
ByteString sVersion( Export::GetEnv( "WORK_STAMP" ));
- if ( !sRoot.Len() || !sVersion.Len()) {
+ if ( !sSolarVer.Len() || !sVersion.Len()) {
fprintf( stderr, "ERROR: No environment set!\n" );
return 1;
}
@@ -972,55 +926,46 @@ int _cdecl main( int argc, char *argv[] )
return 3;
}
- ByteString sMode( "merge" );
- if ( bExport )
- sMode = "extract";
-
- ByteString sICode( sIsoCode );
- if ( !sICode.Len())
- sICode = "not given, support for language 99 disabled";
- if(!bQuiet && !bQuiet2 ){
- fprintf( stdout,
- "\n"
- "============================================================\n"
- "Current settings:\n"
- "============================================================\n"
- "Mode: %s\n"
- "Workspace: %s\n"
- "Source tree: %s\n"
- "Languages: %s\n"
- "ISO code (99): %s\n"
- "Filename: %s\n"
- "Outputfile %s\n"
- "============================================================\n"
- "\n"
- ,
- sMode.GetBuffer(),
- sVersion.GetBuffer(),
- sRoot.GetBuffer(),
- sLanguages.GetBuffer(),
- sICode.GetBuffer(),
- sFileName.GetBuffer(),
- sOutput.GetBuffer()
- );
- }
- SourceTreeLocalizer aIter( sRoot, sVersion , (sOutput.Len() > 0) , bQuiet2 , bSkipLinks );
-
- aIter.SetLanguageRestriction( sLanguages );
- aIter.SetIsoCode99( sIsoCode );
- if ( bExport ){
- if( bQuiet2 ){ /*printf("");*/fflush( stdout );}
- aIter.Extract( sFileName );
- if( bQuiet2 ){ printf("\n %d files found!\n",aIter.GetFileCnt());}
+ DirEntry aEntry( String( sFileName , RTL_TEXTENCODING_ASCII_US ));
+ aEntry.ToAbs();
+ String sFullEntry = aEntry.GetFull();
+ ByteString sFileABS( aEntry.GetFull(), gsl_getSystemTextEncoding());
+ //printf("B %s\nA %s\n",rDestinationFile.GetBuffer(), sFile.GetBuffer());
+ sFileName = sFileABS;
+
+ Treeconfig treeconfig;
+ vector<string> repos;
+ bool hasPwd = treeconfig.getActiveRepositories( repos );
+ if( hasPwd ) cout << "Found special path!\n";
+
+ // localize through all repositories
+ for( vector<string>::iterator iter = repos.begin(); iter != repos.end() ; ++iter )
+ {
+ string curRepository = string( Export::GetEnv("SOURCE_ROOT_DIR") ) + "/" + *iter;
+ cout << "Localizing repository " << curRepository << "\n";
+ SourceTreeLocalizer aIter( ByteString( curRepository.c_str() ) , sVersion , (sOutput.Len() > 0) , bQuiet2 , bSkipLinks );
+ aIter.SetLanguageRestriction( sLanguages );
+ if ( bExport ){
+ if( bQuiet2 ){ /*printf("");*/fflush( stdout );}
+ aIter.Extract( sFileName );
+ if( bQuiet2 ){ printf("\n %d files found!\n",aIter.GetFileCnt());}
+ }
}
- else {
+ if( hasPwd )
+ {
+ string pwd;
+ Export::getCurrentDir( pwd );
+ cout << "Localizing repository " << pwd << "\n";
+ SourceTreeLocalizer aIter( ByteString( pwd.c_str() ) , sVersion , (sOutput.Len() > 0) , bQuiet2 , bSkipLinks );
+ aIter.SetLanguageRestriction( sLanguages );
+ if ( bExport ){
+ if( bQuiet2 ){ /*printf("");*/fflush( stdout );}
+ aIter.Extract( sFileName );
+ if( bQuiet2 ){ printf("\n %d files found!\n",aIter.GetFileCnt());}
+ }
- DirEntry aEntry( String( sFileName, RTL_TEXTENCODING_ASCII_US ));
- if ( !aEntry.Exists())
- return FALSE;
- printf("%s\n",sFileName.GetBuffer());
- aIter.Merge( sFileName , sOutput );
}
return 0;
}
+
diff --git a/transex3/source/makefile.mk b/transex3/source/makefile.mk
index 68b94a5b58fa..a557b210aad0 100644
--- a/transex3/source/makefile.mk
+++ b/transex3/source/makefile.mk
@@ -61,8 +61,8 @@ OBJFILES= \
$(OBJ)$/helpmerge.obj \
$(OBJ)$/helpex.obj \
$(OBJ)$/file.obj \
- $(OBJ)$/directory.obj \
- $(OBJ)$/hw2fw.obj
+ $(OBJ)$/directory.obj
+
LIB1TARGET= $(LB)$/$(TARGET).lib
LIB1ARCHIV= $(LB)$/libtransex.a
@@ -73,8 +73,8 @@ LIB1OBJFILES= $(OBJ)$/export.obj \
$(OBJ)$/srciter.obj \
$(OBJ)$/file.obj \
$(OBJ)$/directory.obj \
- $(OBJ)$/utf8conv.obj \
- $(OBJ)$/hw2fw.obj
+ $(OBJ)$/utf8conv.obj
+
APP1VERSIONMAP=exports.map
@@ -96,7 +96,7 @@ APP1LIBS+= $(LB)$/$(TARGET).lib
APP1DEPN= $(OBJ)$/src_yy_wrapper.obj $(LB)$/$(TARGET).lib
APP2TARGET= helpex
-APP2OBJS= $(OBJ)$/helpmerge.obj $(OBJ)$/xmlparse.obj $(OBJ)$/export2.obj $(OBJ)$/utf8conv.obj $(OBJ)$/merge.obj $(OBJ)$/helpex.obj $(OBJ)$/hw2fw.obj
+APP2OBJS= $(OBJ)$/helpmerge.obj $(OBJ)$/xmlparse.obj $(OBJ)$/export2.obj $(OBJ)$/utf8conv.obj $(OBJ)$/merge.obj $(OBJ)$/helpex.obj
APP2RPATH= NONE
.IF "$(OS)"!="MACOSX"
@@ -110,7 +110,7 @@ APP2STDLIBS+=$(SALLIB) $(EXPATASCII3RDLIB) $(TOOLSLIB) $(VOSLIB)
# extractor and merger for *.lng and *.lng
APP3TARGET= ulfex
-APP3OBJS= $(OBJ)$/lngmerge.obj $(OBJ)$/hw2fw.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj $(OBJ)$/lngex.obj $(OBJ)$/utf8conv.obj
+APP3OBJS= $(OBJ)$/lngmerge.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj $(OBJ)$/lngex.obj $(OBJ)$/utf8conv.obj
APP3RPATH= NONE
.IF "$(OS)"!="MACOSX"
@@ -142,7 +142,7 @@ APP5STDLIBS+= \
# extractor and merger for *.cfg
APP6TARGET= cfgex
-APP6OBJS= $(OBJ)$/cfgmerge.obj $(OBJ)$/cfg_yy_wrapper.obj $(OBJ)$/hw2fw.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj $(OBJ)$/utf8conv.obj
+APP6OBJS= $(OBJ)$/cfgmerge.obj $(OBJ)$/cfg_yy_wrapper.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj $(OBJ)$/utf8conv.obj
.IF "$(OS)"!="MACOSX"
#APP6STDLIBS+= $(BTSTRPLIB)
@@ -159,7 +159,7 @@ APP6STDLIBS+= \
# extractor and merger for *.xrm
APP7TARGET= xrmex
-APP7OBJS= $(OBJ)$/xrmmerge.obj $(OBJ)$/xrm_yy_wrapper.obj $(OBJ)$/hw2fw.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj $(OBJ)$/utf8conv.obj
+APP7OBJS= $(OBJ)$/xrmmerge.obj $(OBJ)$/xrm_yy_wrapper.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj $(OBJ)$/utf8conv.obj
APP7RPATH= NONE
.IF "$(OS)"!="MACOSX"
@@ -174,21 +174,23 @@ APP7STDLIBS+= \
# static libs at end for OS X
.ENDIF
-# encoding converter for text files
-APP8TARGET= txtconv
-#APP8STACK= 16000
-APP8OBJS= $(OBJ)$/utf8conv.obj $(OBJ)$/txtconv.obj $(OBJ)$/hw2fw.obj
-APP8STDLIBS=$(TOOLSLIB) $(SALLIB)
+#
+#APP8TARGET= treeconfig
+#APP8OBJS= $(OBJ)$/treeconfig.obj $(OBJ)$/inireader.obj $(OBJ)$/export2.obj
+#APP8STDLIBS=$(TOOLSLIB) $(SALLIB) $(VOSLIB) $(ICUINLIB) $(STLPORT)
# localizer for l10n framework
APP9TARGET= localize_sl
EXCEPTIONSFILES= \
$(OBJ)$/localize.obj
-APP9OBJS= $(OBJ)$/localize.obj $(OBJ)$/utf8conv.obj $(OBJ)$/srciter.obj $(OBJ)$/export2.obj $(OBJ)$/file.obj $(OBJ)$/directory.obj
+APP9OBJS= $(OBJ)$/localize.obj $(OBJ)$/utf8conv.obj $(OBJ)$/srciter.obj $(OBJ)$/export2.obj $(OBJ)$/file.obj $(OBJ)$/directory.obj $(OBJ)$/treeconfig.obj $(OBJ)$/inireader.obj
APP9STDLIBS+= \
$(TOOLSLIB) \
$(VOSLIB) \
+ $(ICUINLIB) \
+ $(ICUUCLIB) \
+ $(STLPORTLIB) \
$(SALLIB)
DEPOBJFILES=$(APP1OBJS) $(APP2OBJS) $(APP3OBJS) $(APP4OBJS) $(APP5OBJS) $(APP6OBJS) $(APP7OBJS) $(APP8OBJS) $(APP9OBJS)
diff --git a/transex3/source/treeconfig.cxx b/transex3/source/treeconfig.cxx
new file mode 100644
index 000000000000..d9e3b829982b
--- /dev/null
+++ b/transex3/source/treeconfig.cxx
@@ -0,0 +1,128 @@
+#include <vector>
+#include <string>
+#include <iostream>
+#include "treeconfig.hxx"
+#include "export.hxx"
+#ifdef WNT
+#include <direct.h>
+#include <io.h>
+#else
+#include <dirent.h>
+#endif
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+using namespace std;
+
+namespace transex3
+{
+
+bool Treeconfig::parseConfig(){
+
+ string source_config_file = string( static_cast<ByteString>( Export::GetEnv("SOURCE_ROOT_DIR") ).GetBuffer() );
+ if( source_config_file.empty() )
+ {
+ cerr << "Error: no suitable environment set?!?";
+ exit( -1 );
+ }
+ source_config_file += string("/source_config");
+ if( isConfigFilePresent() )
+ {
+ inireader.read( map , source_config_file );
+ return true;
+ }
+ else return false;
+}
+
+// ALWAYS add all repositories from source_config file to the container active_repos
+// if a config_file is present ALWAYS return false
+// if you are in the root of a repository also add it to the container active_repos
+// if you are far inside a repository /my/path/ooo/sw/source then don't add it to the container but return true
+// if you are in some misc place like /tmp then return true
+// => the application can decide what to do in case the function returns true thus how to handle pwd() path
+bool Treeconfig::getActiveRepositories( vector<string>& active_repos ){
+
+ bool isPresent = isConfigFilePresent();
+ bool hasPath = false;
+ string pwd;
+ string guessedRepo;
+ Export::getCurrentDir( pwd );
+ string source_root = Export::GetEnv( "SOURCE_ROOT_DIR" );
+ string solarsrc = Export::GetEnv( "SOLARSRC" );
+ string partial;
+
+ // if we are inside of a repository root then active it otherwise let the app handle the return!
+ unsigned int pos = pwd.find_first_of( source_root );
+ if( pos != string::npos && ( pos + source_root.length() +1 ) < pwd.length()){ // I am within SOURCE_ROOT_DIR
+ partial = pwd.substr( pos + source_root.length() +1 , pwd.length());
+ unsigned int nextPart = partial.find_first_of( "/" );
+ if( nextPart != string::npos )
+ hasPath = true;
+ else
+ guessedRepo = partial;
+ }
+ else // I am NOT within SOURCE_ROOT_DIR
+ hasPath = true;
+
+ if( isPresent )
+ {
+ hasPath = false; // if config_file is present don't care about pwd
+ stringmap* repos = static_cast<stringmap*>( map[ string("repositories") ] );
+ if( repos != 0 )
+ {
+ for( stringmap::iterator iter = repos->begin() ; iter != repos->end() ; ++iter )
+ {
+ if( static_cast<string>( iter->second ) == string( "active" ) )
+ {
+ active_repos.push_back( iter->first );
+ if( static_cast<string>( iter->first ) == guessedRepo )
+ {
+ guessedRepo.clear(); // don't add double in case it is present in config_file
+ }
+ }
+ }
+ }
+ else
+ {
+ cerr << "Error: source_config files doesn't contain a 'repositories' section ?!?";
+ exit( -1 );
+ }
+ }
+ if( !guessedRepo.empty() ){
+ active_repos.push_back( guessedRepo ); // add myrepo
+ }
+ return hasPath; // are we deep inside of a source tree or outside of SOURCE_ROOT_DIR?
+}
+
+void Treeconfig::getCurrentDir( string& dir )
+{
+ char buffer[64000];
+ if( getcwd( buffer , sizeof( buffer ) ) == 0 ){
+ cerr << "Error: getcwd failed!\n";
+ exit( -1 );
+ }
+ dir = string( buffer );
+}
+
+bool Treeconfig::isConfigFilePresent()
+{
+ string config_file = Export::GetEnv( "SOURCE_ROOT_DIR" );
+ config_file += "/source_config";
+
+ struct stat status;
+ if( stat( config_file.c_str() , &status ) < 0 )
+ {
+ return false;
+ }
+#ifdef WNT
+ return ( status.st_mode & _S_IFREG ) && ( _access( config_file.c_str() , 4 ) >= 0 ) ;
+#else
+ return ( status.st_mode & S_IFREG ) && ( access( config_file.c_str() , R_OK ) >= 0 ) ;
+#endif
+}
+
+
+
+}
diff --git a/transex3/source/txtconv.cxx b/transex3/source/txtconv.cxx
deleted file mode 100644
index 2f442b80a83d..000000000000
--- a/transex3/source/txtconv.cxx
+++ /dev/null
@@ -1,168 +0,0 @@
-/*************************************************************************
- *
- * 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: txtconv.cxx,v $
- * $Revision: 1.8 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_transex3.hxx"
-#include <stdio.h>
-#include <tools/fsys.hxx>
-#include <tools/stream.hxx>
-
-// local includes
-#include "utf8conv.hxx"
-
-extern void ConvertHalfwitdhToFullwidth( String& rString );
-
-/*****************************************************************************/
-void Help()
-/*****************************************************************************/
-{
- fprintf( stdout, "\n" );
- fprintf( stdout, "txtconv (c)2001 by StarOffice Entwicklungs GmbH\n" );
- fprintf( stdout, "===============================================\n" );
- fprintf( stdout, "\n" );
- fprintf( stdout, "txtconv converts textfiles from or to UTF-8\n" );
- fprintf( stdout, "\n" );
- fprintf( stdout, "Syntax: txtconv -t|-f charset filename (destinationfile)\n" );
- fprintf( stdout, "Switches: -t => conversion from charset to UTF-8\n" );
- fprintf( stdout, " -f => conversion from UTF-8 to charset\n" );
- fprintf( stdout, "\n" );
- fprintf( stdout, "Allowed charsets:\n" );
- fprintf( stdout, " MS_932 => Japanese\n" );
- fprintf( stdout, " MS_936 => Chinese Simplified\n" );
- fprintf( stdout, " MS_949 => Korean\n" );
- fprintf( stdout, " MS_950 => Chinese Traditional\n" );
- fprintf( stdout, " MS_1250 => East Europe\n" );
- fprintf( stdout, " MS_1251 => Cyrillic\n" );
- fprintf( stdout, " MS_1252 => West Europe\n" );
- fprintf( stdout, " MS_1253 => Greek\n" );
- fprintf( stdout, " MS_1254 => Turkish\n" );
- fprintf( stdout, " MS_1255 => Hebrew\n" );
- fprintf( stdout, " MS_1256 => Arabic\n" );
- fprintf( stdout, " HW2FW => Only with -t, converts half to full width katakana" );
- fprintf( stdout, "\n" );
-}
-
-/*****************************************************************************/
-#if defined(UNX) || defined(OS2)
-int main( int argc, char *argv[] )
-#else
-int _cdecl main( int argc, char *argv[] )
-#endif
-/*****************************************************************************/
-{
- if (( argc != 4 ) && ( argc != 5 )) {
- Help();
- exit ( 0 );
- }
-
- if ( ByteString( argv[ 1 ] ) == "-t" || ByteString( argv[ 1 ] ) == "-f" ) {
- rtl_TextEncoding nEncoding = RTL_TEXTENCODING_MS_1252;
-
- BOOL bHW2FW = FALSE;
-
- ByteString sCharset( argv[ 2 ] );
- sCharset.ToUpperAscii();
-
- if ( sCharset == "MS_932" ) nEncoding = RTL_TEXTENCODING_MS_932;
- else if ( sCharset == "MS_936" ) nEncoding = RTL_TEXTENCODING_MS_936;
- else if ( sCharset == "MS_949" ) nEncoding = RTL_TEXTENCODING_MS_949;
- else if ( sCharset == "MS_950" ) nEncoding = RTL_TEXTENCODING_MS_950;
- else if ( sCharset == "MS_1250" ) nEncoding = RTL_TEXTENCODING_MS_1250;
- else if ( sCharset == "MS_1251" ) nEncoding = RTL_TEXTENCODING_MS_1251;
- else if ( sCharset == "MS_1252" ) nEncoding = RTL_TEXTENCODING_MS_1252;
- else if ( sCharset == "MS_1253" ) nEncoding = RTL_TEXTENCODING_MS_1253;
- else if ( sCharset == "MS_1254" ) nEncoding = RTL_TEXTENCODING_MS_1254;
- else if ( sCharset == "MS_1255" ) nEncoding = RTL_TEXTENCODING_MS_1255;
- else if ( sCharset == "MS_1256" ) nEncoding = RTL_TEXTENCODING_MS_1256;
- else if ( sCharset == "MS_1257" ) nEncoding = RTL_TEXTENCODING_MS_1257;
- else if (( sCharset == "HW2FW" ) && ( ByteString( argv[ 1 ] ) == "-t" )) bHW2FW = TRUE;
-
- else {
- Help();
- exit ( 1 );
- }
-
- DirEntry aSource = DirEntry( String( argv[ 3 ], RTL_TEXTENCODING_ASCII_US ));
- if ( !aSource.Exists()) {
- fprintf( stderr, "\nERROR: File %s not found!\n\n", ByteString( argv[ 3 ] ).GetBuffer());
- exit ( 2 );
- }
-
- String sOutput;
- SvFileStream aOutput;
- if ( argc == 5 ) {
- sOutput= String( argv[ 4 ], RTL_TEXTENCODING_ASCII_US );
- aOutput.Open( sOutput, STREAM_STD_WRITE | STREAM_TRUNC );
- if ( !aOutput.IsOpen()) {
- fprintf( stderr, "\nERROR: Could not open output file %s!\n\n", argv[ 4 ]);
- exit ( 3 );
- }
- }
-
- String sGSI( argv[ 3 ], RTL_TEXTENCODING_ASCII_US );
- SvFileStream aGSI( sGSI, STREAM_STD_READ );
- if ( !aGSI.IsOpen()) {
- fprintf( stderr, "\nERROR: Could not open input file %s!\n\n", argv[ 3 ]);
- exit ( 3 );
- }
-
- ByteString sGSILine;
- while ( !aGSI.IsEof()) {
-
- aGSI.ReadLine( sGSILine );
- if ( bHW2FW ) {
- String sConverter( sGSILine, RTL_TEXTENCODING_UTF8 );
- ConvertHalfwitdhToFullwidth( sConverter );
- sGSILine = ByteString( sConverter, RTL_TEXTENCODING_UTF8 );
- }
- else {
- if ( ByteString( argv[ 1 ] ) == "-t" )
- sGSILine = UTF8Converter::ConvertToUTF8( sGSILine, nEncoding );
- else
- sGSILine = UTF8Converter::ConvertFromUTF8( sGSILine, nEncoding );
- }
-
- if ( aOutput.IsOpen())
- aOutput.WriteLine( sGSILine );
- else
- fprintf( stdout, "%s\n", sGSILine.GetBuffer());
- }
-
- aGSI.Close();
- if ( aOutput.IsOpen())
- aOutput.Close();
- }
- else {
- Help();
- exit( 1 );
- }
-
- return 0;
-}
diff --git a/transex3/source/xrmmerge.cxx b/transex3/source/xrmmerge.cxx
index 4daf94e2357a..f1b3d4d6cb5a 100644
--- a/transex3/source/xrmmerge.cxx
+++ b/transex3/source/xrmmerge.cxx
@@ -163,10 +163,6 @@ extern char *GetOutputFile( int argc, char* argv[])
Export::sLanguages = ByteString( argv[ i ]);
}
break;
- case STATE_ISOCODE99: {
- Export::sIsoCode99 = ByteString( argv[ i ]);
- }
- break;
}
}
}
diff --git a/vcl/inc/vcl/wrkwin.hxx b/vcl/inc/vcl/wrkwin.hxx
index 8b2701420a2f..1dd46d8debe5 100644
--- a/vcl/inc/vcl/wrkwin.hxx
+++ b/vcl/inc/vcl/wrkwin.hxx
@@ -105,7 +105,7 @@ public:
void Restore();
void Maximize( BOOL bMaximize = TRUE );
- BOOL IsMaximized();
+ BOOL IsMaximized() const;
};
#endif // _SV_WRKWIN_HXX
diff --git a/vcl/source/window/wrkwin.cxx b/vcl/source/window/wrkwin.cxx
index 0c19c5c5ee4f..c1f80bb061e5 100644
--- a/vcl/source/window/wrkwin.cxx
+++ b/vcl/source/window/wrkwin.cxx
@@ -310,7 +310,7 @@ void WorkWindow::Maximize( BOOL bMaximize )
ImplSetFrameState( bMaximize ? SAL_FRAMESTATE_MAXIMIZED : SAL_FRAMESTATE_NORMAL );
}
-BOOL WorkWindow::IsMaximized()
+BOOL WorkWindow::IsMaximized() const
{
BOOL bRet = FALSE;